home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Westmount Technology 1994
- #
- # File: @(#)copyenvdia.tcl /main/hindenburg/1
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)copyenvdia.tcl /main/hindenburg/1 20 Sep 1996 Copyright 1994 Westmount Technology
-
- # Start user added include file section
- require procs.tcl
- # End user added include file section
-
- require "m4envdialo.tcl"
-
- Class CopyEnvDialog : {M4EnvDialog} {
- constructor
- method destructor
- method popUp
- method save
- attribute levelObj
- }
-
- constructor CopyEnvDialog {class this name NrOfColumns levelObj} {
- set this [M4EnvDialog::constructor $class $this $name $NrOfColumns]
- $this levelObj $levelObj
- # Start constructor user section
-
- set level [$levelObj uiClass]
- set labelText "Copy To $level Environment As ReadOnly Variable"
- $this setLabelText "$labelText"
-
- # End constructor user section
- return $this
- }
-
- method CopyEnvDialog::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this M4EnvDialog::destructor
- }
-
- method CopyEnvDialog::popUp {this} {
- set m4VarDes [$this m4VarDes]
- m4_var foreach m4var [m4_var meta4UserEnv] {
- if [isCommand $m4VarDes] {
- set label [rmWhiteSpace [$m4VarDes getUiName $m4var]]
- if {"$label" == ""} {
- set label $m4var
- }
- } else {
- set label $m4var
- }
- set m4SortList($label) $m4var
- }
-
- if [info exists m4SortList] {
- set col 0
- foreach index [lsort [array names m4SortList]] {
- set m4var $m4SortList($index)
- $this addToggle $m4var $col $m4var
- incr col 1
- if {! [isCommand $this.top.vp.row.col$col]} {
- set col 0
- }
- }
- }
-
- $this TemplateDialog::popUp
- }
-
- method CopyEnvDialog::save {this} {
- if [[$this levelObj] isA Corporate] {
- set m4etcDir [path_name concat [m4_var get M4_home] etc]
- set m4envFile [path_name concat $m4etcDir m4env]
- } else {
- set m4envFile [[$this levelObj] findCustomFileVersion m4env ""]
- if [$m4envFile isNil] {
- set m4envFile [[$this levelObj] createCustomFileVersion m4env ""]
- }
- $m4envFile edit
- }
-
- set tmpFile [args_file {}]
- set fid [open $tmpFile w]
- set i 0
- [$this buttonSet] foreach toggle {
- set m4var [lindex [$this m4varList] $i]
- if {[$toggle state]} {
- puts $fid "${m4var}=[m4_var get $m4var];RO"
- $toggle state no
- }
- incr i 1
- }
- close $fid
-
- if [[$this levelObj] isA Corporate] {
- copy_text_file $tmpFile $m4envFile
- } else {
- $m4envFile upLoad $tmpFile
- $m4envFile quit
- }
- unlink $tmpFile
- }
-
- # Do not delete this line -- regeneration end marker
-
-