home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
selectmodu.tcl
< prev
next >
Wrap
Text File
|
1997-10-30
|
5KB
|
185 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)selectmodu.tcl /main/titanic/7
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)selectmodu.tcl /main/titanic/7 30 Oct 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
require "dirselectd.tcl"
require "selmodfilt.tcl"
# End user added include file section
Class SelectModuleDialog : {TemplateDialog} {
constructor
method destructor
method popUp
method handleBrowsePressed
method handleBrowseOkPressed
method updateView
method handleSelectionChanged
method getSelectedModules
attribute modulesSelDlg
attribute filter
}
constructor SelectModuleDialog {class this name} {
set this [TemplateDialog::constructor $class $this $name]
# Start constructor user section
$this config \
-modal 1 \
-title "Select Module"
set initialDir [path_name concat [m4_var get M4_home] modules]
$this modulesSelDlg [DirSelectDialog new ${this}modulesSelDlg \
-title "Select Modules Directory" \
-update 0 \
-directory $initialDir \
-okPressed "$this handleBrowseOkPressed" \
-cancelPressed "$this busy false"]
$this filter [SelModFilter new]
# Derived BrowsView and BrowsObject classes
ClassMaker::extend BrowsView SelModuleBrowsView \
"directory filter"
ClassMaker::extend BrowsObject SelModuleBrowsObject modulePath
interface DlgColumn $this.c {
NamedGroup g {
label "Modules Directory"
verStretchFactor 0
verShrinkFactor 0
DlgRow r {
Label moddirlab {
}
PushButton browse {
label "Browse..."
}
}
}
SelModuleBrowsView modules {
rowCount 10
columnCount 50
mode DETAIL
selectionPolicy BROWSE
BrowsHeader lname {
label "Long Name"
width 32
}
BrowsHeader type {
label "Type"
width 20
}
}
}
$this.c.g.r.browse activated "$this handleBrowsePressed"
$this.c.modules selectionChanged "$this handleSelectionChanged"
# End constructor user section
return $this
}
method SelectModuleDialog::destructor {this} {
# Start destructor user section
foreach obj [$this.c.modules objectSet] {
$obj delete
}
# End destructor user section
}
method SelectModuleDialog::popUp {this {newDir ""}} {
busy {
# Initialize the contents of the dialog
if {$newDir == ""} {
set newDir [[$this modulesSelDlg] directory]
} else {
[$this modulesSelDlg] directory $newDir
}
$this updateView $newDir
# Pop it up
$this TemplateDialog::popUp
}
}
method SelectModuleDialog::handleBrowsePressed {this} {
$this busy true
[$this modulesSelDlg] popUp
}
method SelectModuleDialog::handleBrowseOkPressed {this} {
[$this modulesSelDlg] handleOk
$this updateView [[$this modulesSelDlg] directory]
$this busy false
}
method SelectModuleDialog::updateView {this newDir} {
set modView $this.c.modules
set newFilter [$this filter]
if {[$modView directory] == $newDir && [$modView filter] != "" &&
[[$modView filter] equals $newFilter]} {
# Nothing changed
return
}
$modView directory $newDir
$modView filter [$newFilter clone]
foreach obj [$modView objectSet] {
$obj delete
}
$this.c.g.r.moddirlab text $newDir
set moduleDB [ModuleDB::global]
set modulePathList [$moduleDB getFilteredModulePaths $newDir $newFilter]
$modulePathList foreach modulePath {
set activatedScript "eval \[$this okPressed\]"
if [$this autoPopDown] {
set activatedScript "$activatedScript; $this popDown"
}
set name [file tail $modulePath]
set obj [SelModuleBrowsObject new $modView.$name \
-modulePath $modulePath \
-activated $activatedScript]
set propDict [$moduleDB getModulePropDict $modulePath]
$obj label [$propDict set "longName"]
$obj details [$propDict set "type"]
}
$modView sort -command "SelectModuleDialog::compare"
$this okSensitive no
}
method SelectModuleDialog::handleSelectionChanged {this} {
if {[$this.c.modules selectedSet] == ""} {
$this okSensitive no
} else {
$this okSensitive yes
}
}
method SelectModuleDialog::getSelectedModules {this} {
set moduleList ""
foreach obj [$this.c.modules selectedSet] {
lappend moduleList [$obj modulePath]
}
return $moduleList
}
proc SelectModuleDialog::compare {objA objB} {
set objAType [lindex [$objA details] 0]
set objBType [lindex [$objB details] 0]
set result [string compare $objAType $objBType]
if {$result != 0} {
return $result
}
return [string compare [$objA label] [$objB label]]
}
# Do not delete this line -- regeneration end marker