home *** CD-ROM | disk | FTP | other *** search
- # Program: xf
- # Description: handle xfform widgets
- #
- # $Header: XFForm[2.3] Wed Mar 10 11:57:36 1993 garfield@garfield frozen $
-
- global xfDefaultConf
- set xfDefaultConf(xfform) 2
-
- ##########
- # Procedure: XFAdd.XFForm
- # Description: add a XFform
- # Arguments: xfW - the widget
- # xfName - a optional name
- # xfType - add or config
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFAdd.XFForm {xfW xfName xfType} {
- global xfStatus
-
- XFEditSetStatus "Inserting XFForm..."
- set xfName [XFMiscGetUniqueName $xfName form]
- if {"$xfStatus(path)" == "."} {
- if {"$xfType" == "add"} {
- frame .$xfName -class XFForm \
- -borderwidth 2 \
- -relief raised
- } {
- frame .$xfName -class XFForm
- }
-
- XFMiscPositionWidget .$xfName \
- {top fill expand} {-x 0 -y 0 -relwidth 1 -relheight 1}
- XFMiscBindWidgetTree .$xfName
- } {
- if {"$xfType" == "add"} {
- frame $xfStatus(path).$xfName -class XFForm \
- -borderwidth 2 \
- -relief raised
- } {
- frame $xfStatus(path).$xfName -class XFForm
- }
-
- XFMiscPositionWidget $xfStatus(path).$xfName \
- {top fill expand} {-x 0 -y 0 -relwidth 1 -relheight 1}
- XFMiscBindWidgetTree $xfStatus(path).$xfName
- }
-
- incr xfStatus(elementCounter)
- XFEditSetPath $xfStatus(path)
- XFEditSetStatus "Inserting XFForm...done"
- }
-
- ##########
- # Procedure: XFAddTmp.XFForm
- # Description: add a tmp xfform
- # Arguments: none
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFAddTmp.XFForm {} {
-
- catch "destroy .xfEdit.tmplt"
- if {[catch "frame .xfEdit.tmplt -class XFForm"]} {
- XFProcConfConfigure undefined "" "" XFForm add
- } {
- XFProcConfConfigure .xfEdit.tmplt "" "" XFForm add
- }
- }
-
- ##########
- # Procedure: XFConfig.XFForm4
- # Description: configure a XFform
- # Arguments: xfW - the widget
- # xfType - config type (add config)
- # xfClass - the class we configure
- # xfLeader - the leading window
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFConfig.XFForm4 {xfW xfType xfClass {xfLeader ""}} {
- global xfStatus
-
- if {"$xfType" == "add"} {
- set xfName form$xfStatus(elementCounter)
- } {
- set xfName [XFMiscPathName $xfW]
- }
- XFEditSetStatus "Calling parameter setting for XFForm..."
-
- # build widget structure
- XFTmpltToplevel .xf${xfClass}Config4 400x380 \
- "XFForm parameters:[XFMiscPathTail $xfW]" $xfLeader
-
- XFElementInit $xfW .xf${xfClass}Config4 $xfType $xfClass \
- XFXFFormSetXFForm4 parameters $xfName 4
- XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass bg \
- background Background "Background" XFXFFormSetXFForm4
- XFElementScale $xfW .xf${xfClass}Config4 $xfType $xfClass borderwidth \
- borderWidth BorderWidth "Border width" "pixels" 40 XFXFFormSetXFForm4
- XFElementCursor $xfW .xf${xfClass}Config4 $xfType $xfClass \
- XFXFFormSetXFForm4
- XFElementGeometry $xfW .xf${xfClass}Config4 $xfType $xfClass \
- XFXFFormSetXFForm4
- XFElementRelief $xfW .xf${xfClass}Config4 $xfType $xfClass \
- XFXFFormSetXFForm4
- XFElementSize $xfW .xf${xfClass}Config4 $xfType $xfClass XFXFFormSetXFForm4
-
- if {"$xfType" == "add"} {
- .xf${xfClass}Config4.params1.params2.borderwidth.borderwidth set 2
- }
-
- # save current parameter
- XFElementSave $xfW $xfClass {background borderwidth cursor geometry relief}
-
- # packing
- pack append .xf${xfClass}Config4.params1 \
- .xf${xfClass}Config4.params1.params2 {left fill expand}
- pack append .xf${xfClass}Config4 \
- .xf${xfClass}Config4.pathname {top fill frame center} \
- .xf${xfClass}Config4.leave {bottom fill} \
- .xf${xfClass}Config4.additional {bottom fill} \
- .xf${xfClass}Config4.params1 {top fill expand}
-
- XFBindFormConnect .xf${xfClass}Config4.params1.params2 \
- "XFXFFormSetXFForm4 $xfW 0 $xfClass"
-
- XFEditSetStatus "Calling parameter setting for XFForm...done"
- }
-
- ##########
- # Procedure: XFSaveSpecial.XFForm
- # Description: save XFform
- # Arguments: xfW - the widget
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFSaveSpecial.XFForm {xfW} {
-
- return " if {\"\[info procs XFLocalFormConnect\]\" != \"\"} {\n XFLocalFormConnect $xfW\n }\n"
- }
-
- ##########
- # Procedure: XFSaveWidget.XFForm
- # Description: save xfform widget
- # Arguments: xfOutFile - the output file
- # xfW - the widget
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFSaveWidget.XFForm {xfOutFile xfW} {
- global xfConf
-
- set xfTmpString ""
- set xfType [string tolower [winfo class $xfW]]
-
- # what are we doing here ?
- puts $xfOutFile "\n # build widget $xfW"
-
- # write widget type and path name
- puts $xfOutFile " frame $xfW -class XFForm " nonewline
- XFSaveWidgetResource $xfOutFile $xfW
- puts $xfOutFile ""
- }
-
- ##########
- # Procedure: XFXFFormSetXFForm4
- # Description: set XFform parameters
- # Arguments: xfW - the widget
- # xfType - the type of setting (1 = set always, 0 = set
- # only if permanent apply is on)
- # xfClass - the class we configure
- # xfParam1 - ignored parameter
- # Returns: none
- # Sideeffects: none
- ##########
- proc XFXFFormSetXFForm4 {xfW xfType xfClass {xfParam1 ""}} {
- global xfConf
- global xfMisc
-
- if {$xfType == 0 && !$xfConf(applyParameters)} {
- return
- }
- if {"[info commands $xfW]" == ""} {
- return
- }
- XFMiscSetSymbolicName $xfW \
- [.xf${xfClass}Config4.params1.params2.symname.symname get]
-
- XFMiscSetResource $xfW background \
- [.xf${xfClass}Config4.params1.params2.bg.bg get]
- XFMiscSetResource $xfW borderwidth \
- [.xf${xfClass}Config4.params1.params2.borderwidth.borderwidth get]
- XFMiscSetResource $xfW cursor \
- "[.xf${xfClass}Config4.params1.params2.cursor.cursor get]"
- if {[.xf${xfClass}Config4.params1.params2.geo.geo1.geo1 get] > 0 &&
- [.xf${xfClass}Config4.params1.params2.geo.geo2.geo2 get] > 0} {
- XFMiscSetResource $xfW geometry \
- "[.xf${xfClass}Config4.params1.params2.geo.geo1.geo1 get]x[.xf${xfClass}Config4.params1.params2.geo.geo2.geo2 get]"
- } {
- XFMiscSetResource $xfW geometry {}
- XFMiscSetResource $xfW height \
- [.xf${xfClass}Config4.params1.params2.size.size2.size2 get]
- XFMiscSetResource $xfW width \
- [.xf${xfClass}Config4.params1.params2.size.size1.size1 get]
- }
- XFMiscSetResource $xfW relief $xfMisc(relief)
- }
-
- # eof
-
-