home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Westmount Technology 1995
- #
- # File: @(#)desk.tcl /main/titanic/10
- # Author: Marcel Bancken
- # Description: Instantiation of the desk
- #---------------------------------------------------------------------------
- # SccsId = @(#)desk.tcl /main/titanic/10 16 Sep 1997 Copyright 1995 Westmount Technology
-
- OtkRegister::extGui
-
- source [m4_path_name tcl libocl.tcl]
-
- require platform.tcl
- require "caynutil.tcl"
- require "procs.tcl"
- require "messagehdl.tcl"
- require "browser.tcl"
-
- proc usage {} {
- error "Usage: otk desk.tcl -- \[-c caller\] ?objectId?"
- }
-
- set argc 0
- set status INITIAL
- set context ""
- set caller ""
- foreach arg $argv {
- case $arg in {
- {-c} {
- if {$status != "INITIAL"} {
- usage
- }
- set status CALLER
- }
- {default} {
- case $status in {
- {CALLER} {
- set caller $arg
- set status CONTEXT
- }
- {CONTEXT} {
- append context " $arg"
- }
- {default} {
- usage
- }
- }
- }
- }
- incr argc 1
- }
- if {$status != "INITIAL" && $status != "CONTEXT"} {
- usage
- }
-
- # Go one level up until the ClientContext is valid
- set invalidContext [catch {set clientContext [ClientContext::global]} errorMsg]
- if $invalidContext {
- set clientContext [ClientContext::global]
- for {set levelpath [m4_var get M4_levelpath]} \
- {$invalidContext} \
- {set invalidContext \
- [catch {$clientContext setLevelPath $levelpath} errorMsg]} {
- set slash [string last "/" $levelpath]
- if {$slash <= 0} break
- set levelpath [string range $levelpath 0 [expr $slash - 1]]
- }
- }
- if $invalidContext {
- wmtkfatal $errorMsg
- return
- }
-
- # If the initial context is still empty then
- # it is specified by M4_levelpath_ids
- if {"$context" == ""} {
- set levelpath_ids [m4_var get M4_levelpath_ids]
- for {set slash [string last "/" $levelpath_ids]} \
- {$slash >= 0} \
- {set slash [string last "/" $levelpath_ids]} {
- set context \
- "[string range $levelpath_ids [expr $slash + 1] end] $context"
- set levelpath_ids [string range $levelpath_ids 0 [expr $slash - 1]]
- }
- }
-
- set rootIdList [list \
- [list Corporate [[$clientContext currentCorporate] identity]] \
- [list UCustFUiObj "${UCustFUiObj::uiClass}:0"] \
- ]
-
- sourceOptional u_desk
-
- # reset client context
- if { [string trim $context] != "" } {
- set corporateId [[$clientContext currentCorporate] identity]
- [ClientContext::global] setLevelIds "/$corporateId"
- }
-
- Browser new .main -closed {%this stop}
- if [isCommand .main.error] {
- .main.error okPressed "%this delete; .main stop"
- return
- }
- .main config \
- -title "ObjectTeam Browser" \
- -iconTitle "ObjectTeam Browser" \
- -initialContext $context \
- -rootIdList $rootIdList \
- -caller "$caller" \
- -firstExposed {%this initView}
-
- if {! $win95} {
- .main icon desk_64
- }
-
- .main popUp
-