home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cadre Technologies Inc. 1996
- #
- # File: @(#)custdefsar.tcl /main/3
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)custdefsar.tcl /main/3 12 Jun 1996 Copyright 1996 Cadre Technologies Inc.
-
- # Start user added include file section
- require "custobjvie.tcl"
- require "config.tcl"
- # End user added include file section
-
- require "custedarea.tcl"
-
- Class CustDefsArea : {CustEdArea BrowsView} {
- method destructor
- constructor
- method readUserObjects
- method readLevelObjects
- method readConfig
- method deleteObjects
- method writeObject
- method getObjects
- method clearArea
- method dropEvent
- }
-
- method CustDefsArea::destructor {this} {
- # Start destructor user section
- # End destructor user section
- $this CustEdArea::destructor
- }
-
- constructor CustDefsArea {class this name} {
- set this [BrowsView::constructor $class $this $name]
- set this [CustEdArea::constructor $class $this $name]
-
- global classCount
- $this filter [CustObjViewFilter new CustObjViewFilter$classCount $this]
- incr classCount
-
- return $this
- }
-
- method CustDefsArea::readUserObjects {this} {
- # not supported at user level
- }
-
- method CustDefsArea::readLevelObjects {this} {
- set levelIndex [expr [llength [$this _path]] - 1]
- $this read [lindex [$this _path] $levelIndex] [$this _level]
- }
-
- method CustDefsArea::readConfig {this obj name type} {
- if [$obj isA Corporate] {
- if {"[path_name file $name]" != "$name"} {
- set custF [path_name concat [path_name concat \
- [m4_var get M4_home] etc] $name $type ]
- } elseif [catch {set custF [m4_path_name etc $name.$type]}] {
- return ""
- }
- set lineList [readConfigurationFile $custF]
- } else {
- set custObj [$obj findCustomFileVersion $name $type]
- if [$custObj isNil] {
- return ""
- }
- set custF [args_file {}]
- $custObj downLoad $custF
- set lineList [readConfigurationFile $custF]
- unlink $custF
- }
- return $lineList
- }
-
- method CustDefsArea::deleteObjects {this objs} {
- set index 0
- $this CustEdArea::deleteObjects $objs
- foreach obj [$this objectSet] {
- $obj index $index
- incr index
- }
- }
-
- method CustDefsArea::writeObject {this obj fid} {
- $obj writeObject $fid
- }
-
- method CustDefsArea::getObjects {this} {
- return [$this objectSet]
- }
-
- method CustDefsArea::clearArea {this} {
- foreach obj [$this objectSet] {
- $obj delete
- }
- .main selectionChanged
- }
-
- method CustDefsArea::dropEvent {this droppedObject srcIsDst droppedAfterObject droppedForObject} {
- if {$srcIsDst == 0} {
- wmtkerror "Drag & drop between tools is not supported (yet)."
- return
- }
- if {![$droppedObject editable]} {
- wmtkerror "Object not moved, reason: object not editable."
- return
- }
- if {$droppedForObject != ""} {
- if {[$droppedForObject specLevel] != [$droppedObject specLevel]} {
- wmtkerror "Object can not be moved to a higher level."
- return
- }
- }
- set newIndex 0
- set oldIndex [$droppedObject index]
- if {$droppedAfterObject != ""} {
- set newIndex [$droppedAfterObject index]
- if {$newIndex < $oldIndex} {
- incr newIndex
- }
- }
- foreach obj [$this objectSet] {
- set objIndex [$obj index]
- if {$objIndex >= $newIndex && $objIndex < $oldIndex} {
- $obj index [expr $objIndex + 1]
- } elseif {$objIndex > $oldIndex && $objIndex <= $newIndex} {
- $obj index [expr $objIndex - 1]
- }
- }
- $droppedObject index $newIndex
- $this sort -command "CustDefsArea::compare"
- $this isChanged 1
- }
-
- proc CustDefsArea::compare {objA objB} {
- set idxA [$objA index]
- set idxB [$objB index]
- if {$idxA > $idxB} {
- return 1
- }
- if {$idxB > $idxA} {
- return -1
- }
- return 0
- }
-
- # Do not delete this line -- regeneration end marker
-
-