home *** CD-ROM | disk | FTP | other *** search
- #---------------------------------------------------------------------------
- #
- # (c) Cayenne Software Inc. 1996
- #
- # File: @(#)menuentryd.tcl /main/hindenburg/5
- # Author: <generated>
- # Description:
- #---------------------------------------------------------------------------
- # SccsId = @(#)menuentryd.tcl /main/hindenburg/5 24 Oct 1996 Copyright 1996 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 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::fromInterface {this} {
-
- # save page "Interface"
- set spec ""
- set spec "$spec label \"[[$this iPage].DC.nameSLT text]\""
- if {[string trim [[$this iPage].DR.mnemonicDDL selected]] != ""} {
- set spec "$spec mnemonic [[$this iPage].DR.mnemonicDDL selected]"
- }
- set hint [string trim [[$this iPage].DC.hintSLT text]]
- if ![lempty $hint] {
- set spec "$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"
- }
- }
-
- if {$acc == ""} {
- set acc $key
- } else {
- set acc "$acc+$key"
- }
-
- set spec "$spec accelerator $acc"
- }
- set popUpLabel [[$this iPage].DR.popUpLabelSLT text]
- if {$popUpLabel != ""} {
- set spec "$spec popUpLabel \{$popUpLabel\}"
- }
-
- set pixmap [[$this iPage].DC.commandIconI pixmap]
- if {$pixmap != "undef_16"} {
- set spec "$spec toolBarPixmap $pixmap"
- [$this curObject] inToolBar [[$this iPage].DC.inToolBarCB state]
- }
-
- [$this curObject] inPopUpMenu [[$this iPage].DR.inPopUpMenuCB state]
-
- if { [[$this curObject] type] != "CustMenuPushButton" } {
- set spec "$spec state \
- [$this.InterfaceNBP.NG.DC.stateNG.state state]"
- if { [[$this curObject] type] == "CustMenuRadioButton" } {
- set arbiter \
- [$this.InterfaceNBP.NG.DC.arbiterNG.arbiter selected]
- if {$arbiter != ""} {
- set arbiter [MenuEdArea::makeTclName $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 ""
- }
- 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
- }
-
- if {$key == "arbiter"} {
- $this.InterfaceNBP.NG.DC.arbiterNG.arbiter selected $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 [lindex $i 0]
- }
- $this.InterfaceNBP.NG.DC.arbiterNG.arbiter entrySet $arbiters
- $this.InterfaceNBP.NG.DC.arbiterNG.arbiter selected \
- [$object arbiter]
- }
- }
-
- 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
-
-