home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
cbfindfeat.tcl
< prev
next >
Wrap
Text File
|
1996-09-23
|
6KB
|
201 lines
#---------------------------------------------------------------------------
#
# (c) Westmount Technology 1994
#
# File: @(#)cbfindfeat.tcl /main/titanic/2
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)cbfindfeat.tcl /main/titanic/2 23 Sep 1996 Copyright 1994 Westmount Technology
# Start user added include file section
# End user added include file section
Class CBFindFeatureDialog : {TemplateDialog} {
constructor
method destructor
method handleFindAttributesChanged
method handleFindOperationsChanged
method handleCaseSensitiveChanged
method handleUseFeatureFiltersChanged
method handleOkPressed
method handleNextPressed
method findMatchingFeature
method initialisedView
attribute nextFeatureClassIndex
attribute featureNameWildCard
attribute findAttributes
attribute findOperations
}
constructor CBFindFeatureDialog {class this name} {
set this [TemplateDialog::constructor $class $this $name]
$this nextFeatureClassIndex 0
$this featureNameWildCard ""
$this findAttributes 1
$this findOperations 1
# Start constructor user section
$this config -title "Find Feature" \
-okPressed "%this handleOkPressed" \
-helpPressed "$classBrowser helpOnName findFeature"
interface DlgColumn $this.c {
Label message {text "Feature Name:"}
SingleLineText featureNameWildCard {columnCount 15}
NamedGroup g {
label "Find"
DlgRow r {
CheckButton findAttributes {
label "Attributes"
state yes
}
CheckButton findOperations {
label "Operations"
state yes
}
}
}
CheckButton findCaseSensitive {label "Case Sensitive"}
CheckButton useFeatureFilters {label "Use Feature Filters"}
}
$this.c.g.r.findAttributes config \
-stateChanged "$this handleFindAttributesChanged"
$this.c.g.r.findOperations config \
-stateChanged "$this handleFindOperationsChanged"
$this.c.findCaseSensitive config \
-state [expr {([m4_var get M4_find_case_sensitive] == "1") \
? "yes" : "no"}] \
-stateChanged "$this handleCaseSensitiveChanged"
$this.c.useFeatureFilters config \
-state [expr {([m4_var get M4_find_using_filters] == "1") \
? "yes" : "no"}] \
-stateChanged "$this handleUseFeatureFiltersChanged"
PushButton new $this.next -label Next \
-activated "$this handleNextPressed"
# End constructor user section
return $this
}
method CBFindFeatureDialog::destructor {this} {
# Start destructor user section
# End destructor user section
}
method CBFindFeatureDialog::handleFindAttributesChanged {this} {
if {![$this.c.g.r.findAttributes state]} {
$this.c.g.r.findOperations state yes
}
}
method CBFindFeatureDialog::handleFindOperationsChanged {this} {
if {![$this.c.g.r.findOperations state]} {
$this.c.g.r.findAttributes state yes
}
}
method CBFindFeatureDialog::handleCaseSensitiveChanged {this} {
catch {m4_var set M4_find_case_sensitive \
[$this.c.findCaseSensitive state]}
}
method CBFindFeatureDialog::handleUseFeatureFiltersChanged {this} {
catch {m4_var set M4_find_using_filters \
[$this.c.useFeatureFilters state]}
}
method CBFindFeatureDialog::handleOkPressed {this} {
busy {
wmtkmessage "Finding first matching feature ..."
$this nextFeatureClassIndex 0
$this featureNameWildCard [$this.c.featureNameWildCard text]
$this findAttributes [$this.c.g.r.findAttributes state]
$this findOperations [$this.c.g.r.findOperations state]
if {[$this findMatchingFeature]} {
wmtkmessage ""
}
}
}
method CBFindFeatureDialog::handleNextPressed {this} {
set nameChanged [expr {([$this.c.featureNameWildCard text] != \
[$this featureNameWildCard]) ? 1 : 0}]
set attrChanged [expr {([$this.c.g.r.findAttributes state] != \
[$this findAttributes]) ? 1 : 0}]
set operChanged [expr {([$this.c.g.r.findOperations state] != \
[$this findOperations]) ? 1 : 0}]
if {$nameChanged || $attrChanged || $operChanged} {
$this handleOkPressed
} else {
busy {
wmtkmessage "Finding next matching feature ..."
if {[$this findMatchingFeature]} {
wmtkmessage ""
}
}
}
}
method CBFindFeatureDialog::findMatchingFeature {this} {
if {[string length [$this featureNameWildCard]] == 0} {
wmtkmessage "No match found for ''"
return 0
}
set classList [[[$classBrowser classTL] textListEntrySet] contents]
set idx [$this nextFeatureClassIndex]
set found 0
while {$idx < [llength $classList] && !$found} {
set class [lindex $classList $idx]
$class load
[$class featureSet] foreach feat {
if {[$feat isA CBAttribute] &&
![$this findAttributes]} {
continue
}
if {[$feat isA CBMethod] && ![$this findOperations]} {
continue
}
if {[$this.c.useFeatureFilters state] &&
![[$feat getFilter] letsPass $feat]} {
continue
}
if {[$this.c.findCaseSensitive state]} {
set found [string match \
[$this featureNameWildCard] \
[$feat name]]
} else {
set found [string match \
[string tolower [$this featureNameWildCard]] \
[string tolower [$feat name]]]
}
if {$found} {
# skip to next class immediately
$this nextFeatureClassIndex [expr {$idx + 1}]
$class open
break
}
}
incr idx
}
if {!$found} {
if {[$this nextFeatureClassIndex] == 0} {
set featureNameWildCard [$this featureNameWildCard]
wmtkmessage "No match found for '$featureNameWildCard'"
} else {
$this nextFeatureClassIndex 0
return [$this findMatchingFeature]
}
}
return $found
}
method CBFindFeatureDialog::initialisedView {this} {
$this nextFeatureClassIndex 0
}
# Do not delete this line -- regeneration end marker