home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 1998 October
/
PCWorld_1998-10_cd.bin
/
software
/
prehled
/
komix
/
DATA.Z
/
menuentryd.tcl
< prev
next >
Wrap
Text File
|
1997-11-10
|
13KB
|
449 lines
#---------------------------------------------------------------------------
#
# (c) Cayenne Software Inc. 1997
#
# File: @(#)menuentryd.tcl /main/titanic/8
# Author: <generated>
# Description:
#---------------------------------------------------------------------------
# SccsId = @(#)menuentryd.tcl /main/titanic/8 10 Nov 1997 Copyright 1997 Cayenne Software Inc.
# Start user added include file section
require mnemonicbu.tcl
require commandpag.tcl
# End user added include file section
require "menudefine.tcl"
Class MenuEntryDialog : {MenuDefineDialog} {
constructor
method destructor
method createInterface
method clearInterface
method sensitive
method fromInterface
method toInterface
method load
method objName
attribute iPage
attribute cPage
attribute ePage
}
constructor MenuEntryDialog {class this name} {
set this [MenuDefineDialog::constructor $class $this $name]
# Start constructor user section
# End constructor user section
return $this
}
method MenuEntryDialog::destructor {this} {
# Start destructor user section
# End destructor user section
$this MenuDefineDialog::destructor
}
method MenuEntryDialog::createInterface {this} {
#indentation of this function is 4 spaces to make it easier to read
$this MenuDefineDialog::createInterface
# create "interface" page
interface NoteBkPage $this.InterfaceNBP {
label Interface
DlgRow NG {
DlgColumn DC {
DlgRow DR {
verStretchFactor 0
sizeEqual 1
NamedGroup NG {
label Name
DlgColumn DC {
SingleLineText nameSLT {}
}
}
NamedGroup NG {
label Mnemonic
DlgRow DR {
spaceType EVEN
MnemonicButton mnemonicDDL {
verStretchFactor 0
horStretchFactor 0
entrySet " "
}
}
}
}
DlgRow DR {
verStretchFactor 0
sizeEqual 1
NamedGroup NG {
label "Hint text"
DlgColumn DC {
SingleLineText hintSLT {}
}
}
}
DlgRow DR {
verStretchFactor 0
sizeEqual 1
NamedGroup NG {
label Accelerator
DlgRow DR {
DlgColumn DC {
CheckButton ctrlCB {
label Ctrl
}
CheckButton shiftCB {
label Shift
}
CheckButton altCB {
label Alt
}
}
DlgColumn DC {
verStretchFactor 0
SingleLineText acceleratorSLT {
columnCount 5
}
}
}
}
NamedGroup NG {
label ToolBar
DlgColumn DC {
Image commandIconI {
}
PushButton commandIconPB {
label "Select Icon"
}
CheckButton inToolBarCB {
label "Place in toolbar"
}
}
}
}
DlgRow DR {
verStretchFactor 0
NamedGroup NG {
label "Popup menu"
DlgRow DR {
CheckButton inPopUpMenuCB {
label "Place in popup menu"
}
SingleLineText popUpLabelSLT {
columnCount 30
}
}
}
}
}
}
}
$this iPage $this.InterfaceNBP.NG.DC.DR.NG
[$this iPage].DC.commandIconPB activated "[.main smallIconSelector] \
select [$this iPage].DC.commandIconI"
[$this iPage].DC.nameSLT textModified "[$this iPage].DR.mnemonicDDL \
entrySet \[%this text\]"
# create "command" page
$this cPage [CommandPage new $this.cPage]
# create "enable/disable" page
if {[[.main editorArea] toolType] == "browser"} {
require "brenablepa.tcl"
$this ePage [BrEnablePage new $this.ePage]
} elseif {[[.main editorArea] toolType] == "class"} {
require "clenablepa.tcl"
$this ePage [ClEnablePage new $this.ePage]
} else {
require "edenablepa.tcl"
$this ePage [EdEnablePage new $this.ePage]
}
}
method MenuEntryDialog::clearInterface {this} {
$this MenuDefineDialog::clearInterface
# clean page "Interface"
[$this iPage].DC.nameSLT text ""
[$this iPage].DC.hintSLT text ""
[$this iPage].DR.mnemonicDDL entrySet {}
[$this iPage].DR.DC.ctrlCB state 0
[$this iPage].DR.DC.shiftCB state 0
[$this iPage].DR.DC.altCB state 0
[$this iPage].DR.DC.acceleratorSLT text ""
[$this iPage].DC.commandIconI pixmap undef_16
[$this iPage].DC.inToolBarCB state 0
[$this iPage].DR.inPopUpMenuCB state 0
[$this iPage].DR.popUpLabelSLT text ""
if { [[$this curObject] type] != "CustMenuPushButton" } {
$this.InterfaceNBP.NG.DC.stateNG.state state 0
if { [[$this curObject] type] == "CustMenuRadioButton" } {
$this.InterfaceNBP.NG.DC.arbiterNG.arbiter \
entrySet {dummyA dummyB dummyC}
}
}
# clean page "Command"
[$this cPage] clearInterface
# clean page "Enable/Disable"
[$this ePage] clearInterface
}
method MenuEntryDialog::sensitive {this args} {
$this MenuDefineDialog::sensitive $args
if {[llength $args] == 0} {
return [[$this iPage].DC.nameSLT sensitive]
} else {
set sensitive [lindex $args 0]
}
# clean page "Interface"
[$this iPage].DC.nameSLT sensitive $sensitive
[$this iPage].DC.hintSLT sensitive $sensitive
[$this iPage].DR.mnemonicDDL sensitive $sensitive
[$this iPage].DR.DC.ctrlCB sensitive $sensitive
[$this iPage].DR.DC.shiftCB sensitive $sensitive
[$this iPage].DR.DC.altCB sensitive $sensitive
[$this iPage].DR.DC.acceleratorSLT sensitive $sensitive
[$this iPage].DC.commandIconPB sensitive $sensitive
[$this iPage].DC.commandIconI sensitive $sensitive
[$this iPage].DC.inToolBarCB sensitive $sensitive
[$this iPage].DR.inPopUpMenuCB sensitive $sensitive
[$this iPage].DR.popUpLabelSLT sensitive $sensitive
if { [[$this curObject] type] != "CustMenuPushButton" } {
$this.InterfaceNBP.NG.DC.stateNG.state sensitive $sensitive
if { [[$this curObject] type] == "CustMenuRadioButton" } {
$this.InterfaceNBP.NG.DC.arbiterNG.arbiter sensitive $sensitive
}
}
[$this cPage] sensitive $args
[$this ePage] sensitive $args
return $sensitive
}
method MenuEntryDialog::fromInterface {this} {
# save page "Interface"
set spec [list label [[$this iPage].DC.nameSLT text]]
if {[string trim [[$this iPage].DR.mnemonicDDL selected]] != ""} {
lappend spec mnemonic [[$this iPage].DR.mnemonicDDL selected]
}
set hint [string trim [[$this iPage].DC.hintSLT text]]
if ![lempty $hint] {
lappend spec hintText $hint
}
set key [string trim [[$this iPage].DR.DC.acceleratorSLT text]]
if ![lempty $key] {
set acc ""
if [[$this iPage].DR.DC.ctrlCB state] {
set acc "Ctrl"
}
if [[$this iPage].DR.DC.shiftCB state] {
if {$acc == ""} {
set acc "Shift"
} else {
set acc "$acc+Shift"
}
}
if [[$this iPage].DR.DC.altCB state] {
if {$acc == ""} {
set acc "Alt"
} else {
set acc "$acc+Alt"
}
}
regsub -all {\\} $key {\\\\} key
if {$acc == ""} {
set acc $key
} else {
set acc "$acc+$key"
}
lappend spec accelerator $acc
}
set popUpLabel [[$this iPage].DR.popUpLabelSLT text]
if {$popUpLabel != ""} {
lappend spec popUpLabel $popUpLabel
}
set pixmap [[$this iPage].DC.commandIconI pixmap]
if {$pixmap != "undef_16"} {
lappend spec toolBarPixmap $pixmap
[$this curObject] inToolBar [[$this iPage].DC.inToolBarCB state]
}
[$this curObject] inPopUpMenu [[$this iPage].DR.inPopUpMenuCB state]
if { [[$this curObject] type] != "CustMenuPushButton" } {
lappend spec state
lappend spec [$this.InterfaceNBP.NG.DC.stateNG.state state]
if { [[$this curObject] type] == "CustMenuRadioButton" } {
set arbiter \
[$this.InterfaceNBP.NG.DC.arbiterNG.arbiter selected]
if {$arbiter != ""} {
[$this curObject] arbiter $arbiter
} else {
# arbiter must be selected
wmtkerror "No Radio Arbiter selected."
return ""
}
}
}
# save page "Command"
set cmdSpec [[$this cPage] fromInterface]
if {$cmdSpec == ""} {
return ""
}
# don't use lappend for this purpose
if { [[$this curObject] type] == "CustMenuPushButton" } {
set spec "$spec activated $cmdSpec"
} else {
set spec "$spec stateChanged $cmdSpec"
}
# save page "Enable/Disable"
set spec "$spec [[$this ePage] fromInterface]"
return $spec
}
method MenuEntryDialog::toInterface {this key value} {
# page "Interface"
if {$key == "label"} {
[$this iPage].DC.nameSLT text $value
[$this iPage].DR.mnemonicDDL entrySet $value
return
}
if {$key == "hintText"} {
[$this iPage].DC.hintSLT text $value
}
if {$key == "mnemonic"} {
[$this iPage].DR.mnemonicDDL selected $value
return
}
if {$key == "accelerator"} {
if {[string first "Ctrl" $value] != -1} {
[$this iPage].DR.DC.ctrlCB state 1
}
if {[string first "Shift" $value] != -1} {
[$this iPage].DR.DC.shiftCB state 1
}
if {[string first "Alt" $value] != -1} {
[$this iPage].DR.DC.altCB state 1
}
set index [string last "+" $value]
if {$index == -1} {
set accKey $value
} else {
incr index
set accKey [string range $value $index end ]
}
[$this iPage].DR.DC.acceleratorSLT text $accKey
return
}
if {$key == "toolBarPixmap"} {
[$this iPage].DC.commandIconI pixmap $value
return
}
if {$key == "popUpLabel"} {
[$this iPage].DR.popUpLabelSLT text $value
return
}
# page "Command"
if {$key == "activated" || $key == "stateChanged"} {
[$this cPage] toInterface $value
}
# page "Enable/disable"
[$this ePage] toInterface $key $value
if {$key == "state"} {
$this.InterfaceNBP.NG.DC.stateNG.state state $value
}
}
method MenuEntryDialog::load {this object} {
if { [$object type] != "CustMenuPushButton" } {
if ![isCommand $this.InterfaceNBP.NG.DC.stateNG] {
interface NamedGroup $this.InterfaceNBP.NG.DC.stateNG {
label "Initial State"
CheckButton state {
label State
}
}
}
if { [$object type] == "CustMenuRadioButton" } {
if ![isCommand $this.InterfaceNBP.NG.DC.arbiterNG] {
interface NamedGroup \
$this.InterfaceNBP.NG.DC.arbiterNG {
label "Radio Arbiter"
allowResize 1
VerRadioGroup arbiter {
}
}
}
}
} else {
if [isCommand $this.InterfaceNBP.NG.DC.stateNG] {
$this.InterfaceNBP.NG.DC.stateNG delete
}
if [isCommand $this.InterfaceNBP.NG.DC.arbiterNG] {
$this.InterfaceNBP.NG.DC.arbiterNG delete
}
}
$this MenuDefineDialog::load $object
[$this iPage].DC.inToolBarCB state [$object inToolBar]
[$this iPage].DR.inPopUpMenuCB state [$object inPopUpMenu]
if { [$object type] == "CustMenuRadioButton" } {
set arbiters {}
foreach i [[$object parent] arbiters] {
lappend arbiters [MenuEdArea::makeTclName [lindex $i 0]]
}
$this.InterfaceNBP.NG.DC.arbiterNG.arbiter entrySet $arbiters
$this.InterfaceNBP.NG.DC.arbiterNG.arbiter selected \
[$object arbiter]
}
if [$object editable] {
$this sensitive 1
} else {
$this sensitive 0
}
}
method MenuEntryDialog::objName {this args} {
if {$args == ""} {
return [[$this iPage].DC.nameSLT text]
} else {
[$this iPage].DC.nameSLT text [join $args]
}
}
# Do not delete this line -- regeneration end marker