home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
brenablepa.tcl
< prev
next >
Wrap
Text File
|
1997-03-14
|
11KB
|
360 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)brenablepa.tcl /main/titanic/6
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)brenablepa.tcl /main/titanic/6 14 Mar 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
# End user added include file section
require "cobrenable.tcl"
Class BrEnablePage : {CoBrEnablePage} {
constructor
method destructor
method addRepType
method removeRepType
method addBrowserType
method removeBrowserType
method createInterface
method clearInterface
method sensitive
method fromInterface
method toInterface
method makeListUnique
method getBrowserTypes
}
constructor BrEnablePage {class this name} {
set this [CoBrEnablePage::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method BrEnablePage::destructor {this} {
# Start destructor user section
# End destructor user section
$this CoBrEnablePage::destructor
}
method BrEnablePage::addRepType {this} {
set newSelected [[$this if].classTL selectedSet]
# add the selected repTypes to the selected textlist
set orgEntrySet [[$this if].selClassTL entrySet]
set newEntrySet [lsort [concat $orgEntrySet $newSelected]]
[$this if].selClassTL entrySet $newEntrySet
[[$this noteBkDialog] cPage] setMethods $newEntrySet
# remove the selected repTypes from the TextList
set newEntrySet ""
foreach entry [[$this if].classTL entrySet] {
if {[lsearch -exact $newSelected $entry] == -1} {
lappend newEntrySet $entry
}
}
[$this if].classTL entrySet $newEntrySet
set newEntrySet [$this getBrowserTypes [[$this if].selClassTL entrySet]]
# remove the already selected possible browserTypes
set newStrippedEntrySet ""
set alreadySelectedSet [[$this if].selFileTL entrySet]
foreach entry $newEntrySet {
if {[lsearch -exact $alreadySelectedSet $entry] == -1} {
lappend newStrippedEntrySet $entry
}
}
[$this if].fileTL entrySet $newStrippedEntrySet
}
method BrEnablePage::removeRepType {this} {
set newSelected [[$this if].selClassTL selectedSet]
# add the selected repTypes to the textlist
set orgEntrySet [[$this if].classTL entrySet]
set newEntrySet [lsort [concat $orgEntrySet $newSelected]]
[$this if].classTL entrySet [$this makeListUnique $newEntrySet]
# remove the selected repTypes from the selected textlist
set newEntrySet ""
foreach entry [[$this if].selClassTL entrySet] {
if {[lsearch -exact $newSelected $entry] == -1} {
lappend newEntrySet $entry
}
}
[$this if].selClassTL entrySet $newEntrySet
[$this if].selClassTL selectedSet ""
set newEntrySet [$this getBrowserTypes [[$this if].selClassTL entrySet]]
# remove the possible browserTypes that are no longer valid
set newStrippedEntrySet ""
set entrySet [[$this if].fileTL entrySet]
foreach entry $entrySet {
if {[lsearch -exact $newEntrySet $entry] != -1} {
lappend newStrippedEntrySet $entry
}
}
[$this if].fileTL entrySet $newStrippedEntrySet
# remove the selected browserTypes that are no longer valid
set newStrippedEntrySet ""
set alreadySelectedSet [[$this if].selFileTL entrySet]
foreach entry $alreadySelectedSet {
if {[lsearch -exact $newEntrySet $entry] != -1} {
lappend newStrippedEntrySet $entry
}
}
[$this if].selFileTL entrySet $newStrippedEntrySet
[[$this noteBkDialog] cPage] setMethods $newStrippedEntrySet
}
method BrEnablePage::addBrowserType {this} {
set newSelected [[$this if].fileTL selectedSet]
# add the selected fileTypes to the selected textlist
set orgEntrySet [[$this if].selFileTL entrySet]
set newEntrySet [lsort [concat $orgEntrySet $newSelected]]
set newEntrySet [$this makeListUnique $newEntrySet]
[$this if].selFileTL entrySet $newEntrySet
[$this if].selFileTL selectedSet ""
# remove the selected fileTypes from the TextList
set newEntrySet ""
foreach entry [[$this if].fileTL entrySet] {
if {[lsearch -exact $newSelected $entry] == -1} {
lappend newEntrySet $entry
}
}
[$this if].fileTL entrySet $newEntrySet
}
method BrEnablePage::removeBrowserType {this} {
set newSelected [[$this if].selFileTL selectedSet]
# add the selected fileTypes to the textlist
set orgEntrySet [[$this if].fileTL entrySet]
set newEntrySet [lsort [concat $orgEntrySet $newSelected]]
set newEntrySet [$this makeListUnique $newEntrySet]
[$this if].fileTL entrySet $newEntrySet
# remove the selected fileTypes from the selected textlist
set newEntrySet ""
foreach entry [[$this if].selFileTL entrySet] {
if {[lsearch -exact $newSelected $entry] == -1} {
lappend newEntrySet $entry
}
}
[$this if].selFileTL entrySet $newEntrySet
[$this if].selFileTL selectedSet ""
}
method BrEnablePage::createInterface {this} {
# create "enable/disable" page
interface DlgRow $this.NG {
DlgColumn DC {
DlgRow DR {
DlgColumn DC {
Label L {
text "disabled for classes"
}
TextList classTL {
selectionPolicy MULTIPLE
rowCount 6
}
Label L {
text "disabled for browser types"
}
TextList fileTL {
selectionPolicy MULTIPLE
rowCount 6
}
}
DlgColumn DC {
Label dummyLayoutLabel {}
Label dummyLayoutLabel {}
horStretchFactor 0
horShrinkFactor 0
PushButton addRepPB {
label "Add ->"
}
PushButton removeRepPB {
label "<- Remove"
}
Label dummyLayoutLabel {}
Label dummyLayoutLabel {}
horStretchFactor 0
horShrinkFactor 0
PushButton addBroPB {
label "Add ->"
}
PushButton removeBroPB {
label "<- Remove"
}
}
DlgColumn DC {
Label L {
text "enabled (no entries means no check on classes)"
}
TextList selClassTL {
selectionPolicy MULTIPLE
rowCount 6
}
Label L {
text "enabled (no entries means no check on types)"
}
TextList selFileTL {
selectionPolicy MULTIPLE
rowCount 6
}
}
}
Label dummyLayoutLabel {}
}
}
$this.NG.DC.DR.DC.addRepPB activated "$this addRepType"
$this.NG.DC.DR.DC.removeRepPB activated " $this removeRepType "
$this.NG.DC.DR.DC.addBroPB activated " $this addBrowserType "
$this.NG.DC.DR.DC.removeBroPB activated " $this removeBrowserType "
CoBrEnablePage::createInterface $this
}
method BrEnablePage::clearInterface {this} {
set classTypes "[[.main BrowsObj] names]"
[$this if].classTL entrySet [lsort $classTypes]
[$this if].classTL selectedSet ""
[$this if].selClassTL entrySet ""
[$this if].selClassTL selectedSet ""
[[$this noteBkDialog] cPage] setMethods ""
[$this if].fileTL entrySet ""
[$this if].selFileTL entrySet ""
[$this if].selFileTL selectedSet ""
[$this if].selCountOM selected "don't care"
[$this if].checkOn selected "Nothing"
[$this if].enableMLT text ""
}
method BrEnablePage::sensitive {this args} {
if {[llength $args] == 0} {
return [[$this if].classTL sensitive]
} else {
set sensitive [lindex $args 0]
}
[$this if].classTL sensitive $sensitive
[$this if].classTL sensitive $sensitive
[$this if].selClassTL sensitive $sensitive
[$this if].selClassTL sensitive $sensitive
[[$this noteBkDialog] cPage] sensitive $args
[$this if].fileTL sensitive $sensitive
[$this if].selFileTL sensitive $sensitive
[$this if].selFileTL sensitive $sensitive
[$this if].selCountOM sensitive $sensitive
[$this if].checkOn sensitive $sensitive
[$this if].enableMLT sensitive $sensitive
[$this if].addRepPB sensitive $sensitive
[$this if].removeRepPB sensitive $sensitive
[$this if].addBroPB sensitive $sensitive
[$this if].removeBroPB sensitive $sensitive
return $sensitive
}
method BrEnablePage::fromInterface {this} {
set spec [CoBrEnablePage::fromInterface $this]
set selObjTypes [[$this if].selClassTL entrySet]
# save this part only if not all the possible classes
# are selected
if {![lempty $selObjTypes]} {
lappend spec selIsATypes $selObjTypes
}
set selFileTypes [[$this if].selFileTL entrySet]
# save this part only if not all the possible fileTypes
# are selected
if {![lempty $selFileTypes]} {
lappend spec selTypes $selFileTypes
}
return $spec
}
method BrEnablePage::toInterface {this key value} {
CoBrEnablePage::toInterface $this $key $value
if {$key == "selIsATypes"} {
# remove the selected isa types from the classTL
set newEntrySet ""
foreach entry [[$this if].classTL entrySet] {
if {[lsearch -exact $value $entry] == -1} {
lappend newEntrySet $entry
}
}
[$this if].classTL entrySet $newEntrySet
[$this if].selClassTL entrySet $value
$this addRepType
}
if {$key == "selTypes"} {
# remove the selected types from the fileTL
# remove the selected isa types from the classTL
set newEntrySet ""
foreach entry [[$this if].fileTL entrySet] {
if {[lsearch -exact $value $entry] == -1} {
lappend newEntrySet $entry
}
}
[$this if].fileTL entrySet $newEntrySet
[$this if].selFileTL entrySet $value
}
}
method BrEnablePage::makeListUnique {this list} {
set unique {}
foreach n $list {
if {[lsearch -exact $unique $n] == -1} {
lappend unique $n
}
}
return $unique
}
method BrEnablePage::getBrowserTypes {this classes} {
set newEntrySet ""
foreach i $classes {
set types [CustEditor::subTypes $i]
foreach type $types {
if {[lsearch -exact $newEntrySet $type] == -1} {
lappend newEntrySet $type
}
}
}
return $newEntrySet
}
# Do not delete this line -- regeneration end marker