# Program: xf
# Description: handle xygraph widgets
#
# $Header: XYGraph[2.3] Wed Mar 10 11:57:38 1993 garfield@garfield frozen $

global xfDefaultConf
set xfDefaultConf(xygraph) 5

##########
# Procedure: XFAdd.XYGraph
# Description: add a xygraph
# Arguments: xfW - the widget
#            xfName - a optional name
#            xfType - add or config
# Returns: none
# Sideeffects: none
##########
proc XFAdd.XYGraph {xfW xfName xfType} {
  global xfConf
  global xfStatus

  XFEditSetStatus "Inserting XYGraph..."
  set xfName [XFMiscGetUniqueName $xfName xygraph]
  if {"$xfStatus(path)" == "."} {
    if {"$xfType" == "add"} {
      if {[catch "xygraph .$xfName" xfResult]} {
        XFProcError "$xfResult"
        XFEditSetStatus "Inserting XYGraph...aborted"
        return
      }
    } {
      if {[catch "xygraph .$xfName" xfResult]} {
        XFProcError "$xfResult"
        XFEditSetStatus "Inserting XYGraph...aborted"
        return
      }
    }

    XFMiscPositionWidget .$xfName
    XFMiscBindWidgetTree .$xfName
  } {
    if {"$xfType" == "add"} {
      if {[catch "xygraph $xfStatus(path).$xfName" xfResult]} {
        XFProcError "$xfResult"
        XFEditSetStatus "Inserting XYGraph...aborted"
        return
      }
    } {
      if {[catch "xygraph $xfStatus(path).$xfName" xfResult]} {
        XFProcError "$xfResult"
        XFEditSetStatus "Inserting XYGraph...aborted"
        return
      }
    }

    XFMiscPositionWidget $xfStatus(path).$xfName
    XFMiscBindWidgetTree $xfStatus(path).$xfName
  }

  incr xfStatus(elementCounter)
  XFEditSetPath $xfStatus(path)
  XFEditSetStatus "Inserting XYGraph...done"
}

##########
# Procedure: XFConfig.XYGraph4
# Description: configure a xygraph
# Arguments: xfW - the widget
#            xfType - config type (add config)
#            xfClass - the class we configure
#            xfLeader - the leading window
# Returns: none
# Sideeffects: none
##########
proc XFConfig.XYGraph4 {xfW xfType xfClass {xfLeader ""}} {
  global xfMisc
  global xfStatus

  if {"$xfType" == "add"} {
    set xfName xygraph$xfStatus(elementCounter)
  } {
    set xfName [XFMiscPathName $xfW]
  }
  XFEditSetStatus "Calling parameter setting for XYGraph..."

  # build widget structure
  XFTmpltToplevel .xf${xfClass}Config4 400x720 \
    "XYGraph parameters:[XFMiscPathTail $xfW]" $xfLeader

  XFElementInit $xfW .xf${xfClass}Config4 $xfType $xfClass \
    XFXYGraphSetXYGraph4 parameters $xfName 4
  XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass bg \
    background Background "Background" XFXYGraphSetXYGraph4
  XFElementScale $xfW .xf${xfClass}Config4 $xfType $xfClass borderwidth \
    borderWidth BorderWidth "Border width" "pixels" 40 \
    XFXYGraphSetXYGraph4
  XFElementFont $xfW .xf${xfClass}Config4 $xfType $xfClass \
    font font Font "Font" XFXYGraphSetXYGraph4
  XFElementColor $xfW .xf${xfClass}Config4 $xfType $xfClass fg \
    foreground Foreground "Foreground" XFXYGraphSetXYGraph4
  XFElementGeometry $xfW .xf${xfClass}Config4 $xfType $xfClass \
    XFXYGraphSetXYGraph4
  XFElementScaleDouble $xfW .xf${xfClass}Config4 $xfType \
    $xfClass lpos "Legend position" "X" "Y" \
      [winfo screenwidth .] [winfo screenheight .]
  XFElementBoolean $xfW .xf${xfClass}Config4 $xfType $xfClass retrace \
    "Draw retrace lines" XFXYGraphSetXYGraph4
  XFElementBoolean $xfW .xf${xfClass}Config4 $xfType $xfClass showlegend \
    "Show legend" XFXYGraphSetXYGraph4
  XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass title \
    title Title "Title" XFXYGraphSetXYGraph4
  XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass xlabel \
    xlabel Label "X label" XFXYGraphSetXYGraph4
  XFElementBoolean $xfW .xf${xfClass}Config4 $xfType $xfClass xlogscale \
    "X log scale" XFXYGraphSetXYGraph4
  XFElementScale $xfW .xf${xfClass}Config4 $xfType $xfClass xsubticks \
    xsubticks SubTicks "X sub ticks" "" 50 XFXYGraphSetXYGraph4
  XFElementScale $xfW .xf${xfClass}Config4 $xfType $xfClass xstepsize \
    xstepsize StepSize "X step size" "" 100 XFXYGraphSetXYGraph4
  XFElementText $xfW .xf${xfClass}Config4 $xfType $xfClass ylabel \
    ylabel Label "Y label" XFXYGraphSetXYGraph4
  XFElementBoolean $xfW .xf${xfClass}Config4 $xfType $xfClass ylogscale \
    "Y log scale" XFXYGraphSetXYGraph4
  XFElementScale $xfW .xf${xfClass}Config4 $xfType $xfClass ysubticks \
    ysubticks SubTicks "Y sub ticks" "" 50 XFXYGraphSetXYGraph4
  XFElementScale $xfW .xf${xfClass}Config4 $xfType $xfClass ystepsize \
    ystepsize StepSize "Y step size" "" 100 XFXYGraphSetXYGraph4

  if {"$xfType" != "add"} {
    set xfTmpVal [string trim [lindex [$xfW configure -legendposition] 4] @]
    if {[string first , $xfTmpVal] >= 0} {
      .xf${xfClass}Config4.params1.params2.lpos.lpos1.lpos1 set \
        [string range $xfTmpVal 0 [expr [string first , $xfTmpVal]-1]]
      .xf${xfClass}Config4.params1.params2.lpos.lpos2.lpos2 set \
        [string range $xfTmpVal [expr [string first , $xfTmpVal]+1] end]
    }
  }

  XFMiscSetResource .xf${xfClass}Config4.params1.params2.lpos.lpos1.lpos1 \
    command "XFXYGraphSetXYGraph4 $xfW 0 $xfClass"
  XFMiscSetResource .xf${xfClass}Config4.params1.params2.lpos.lpos2.lpos2 \
    command "XFXYGraphSetXYGraph4 $xfW 0 $xfClass"

  # save current parameter
  XFElementSave $xfW $xfClass {background borderwidth font foreground geometry legendpos retrace showlegend title xlabel xlogscale xsubticks xstepsize ylabel ylogscale ysubticks ystepsize}

  # 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 \
    "XFXYGraphSetXYGraph4 $xfW 0 $xfClass"

  XFEditSetStatus "Calling parameter setting for XYGraph...done"
}

##########
# Procedure: XFConfig.XYGraph5
# Description: configure a xygraph
# Arguments: xfW - the widget
#            xfType - config type (add config)
#            xfClass - the class we configure
#            xfLeader - the leading window
# Returns: none
# Sideeffects: none
##########
proc XFConfig.XYGraph5 {xfW xfType xfClass {xfLeader ""}} {
  global tkVersion
  global xfBind
  global xfMisc
  global xfStatus

  set xfMisc(XYGraphCurrentType) "<line>"
  set xfMisc(XYGraphAnchor) "n"
  set xfMisc(XYGraphSymbol) "solid"

  set xfName [XFMiscPathName $xfW]
  XFEditSetStatus "Calling parameter setting for XYGraph..."

  # build widget structure
  XFTmpltToplevel .xf${xfClass}Config5 400x600 \
    "XYGraph parameters:[XFMiscPathTail $xfW]" $xfLeader

  XFElementInit $xfW .xf${xfClass}Config5 $xfType $xfClass \
    XFXYGraphSetXYGraph5 parameters $xfName 5

  XFTmpltFrame .xf${xfClass}Config5.params1.params2.frame1 0

  XFTmpltFrame .xf${xfClass}Config5.params1.params2.frame1.elements 0

  XFTmpltFrame .xf${xfClass}Config5.params1.params2.frame1.elements.elem1 0

  XFTmpltFrame .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 0

  XFTmpltFrame .xf${xfClass}Config5.params1.params2.frame1.children 0

  XFTmpltFrame .xf${xfClass}Config5.params1.params2.commands 0

  menubutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.entries \
    -text {XYGraph entry:} \
    -underline 0 \
    -menu ".xf${xfClass}Config5.params1.params2.frame1.elements.elem1.entries.m"

  menu .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.entries.m
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.entries.m \
    add radiobutton \
      -label {Line} \
      -variable xfMisc(XYGraphCurrentType) \
      -value "<line>" \
      -underline 0 \
      -command "XFXYGraphSetItems line $xfClass"
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.entries.m \
    add radiobutton \
      -label {Tag} \
      -variable xfMisc(XYGraphCurrentType) \
      -value "<tag>" \
      -underline 0 \
      -command "XFXYGraphSetItems tag $xfClass"

  label \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.message1 \
      -anchor w \
      -text {Line}
  
  button .xf${xfClass}Config5.params1.params2.commands.insert \
    -text {Insert item} \
    -command "XFXYGraphInsertItem $xfW $xfClass"

  button .xf${xfClass}Config5.params1.params2.commands.modify \
    -text {Modify item} \
    -command "XFXYGraphModifyItem $xfW $xfClass"

  button .xf${xfClass}Config5.params1.params2.commands.delete \
    -text {Delete item} \
    -command "XFXYGraphDeleteItem $xfW $xfClass"

  XFTmpltLabledEntry \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
      tag "Item name:"

  XFTmpltFrame \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor 0

  label .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.message1 \
    -relief raised \
    -text {Anchor:}

  XFTmpltFrame \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor 0

  XFTmpltFrame .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f1 0

  XFTmpltFrame .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2 0

  XFTmpltFrame .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f3 0

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f1.nw \
    -anchor w \
    -text {NW} \
    -variable xfMisc(XYGraphAnchor) \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f1.w \
    -anchor w \
    -text {W} \
    -variable xfMisc(XYGraphAnchor) \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f1.sw \
    -anchor w \
    -text {SW} \
    -variable xfMisc(XYGraphAnchor) \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2.n \
    -anchor w \
    -text {N} \
    -variable xfMisc(XYGraphAnchor) \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2.c \
    -anchor w \
    -text {C} \
    -variable xfMisc(XYGraphAnchor) \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2.s \
    -anchor w \
    -text {S} \
    -variable xfMisc(XYGraphAnchor) \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f3.ne \
    -anchor w \
    -text {NE} \
    -variable xfMisc(XYGraphAnchor) \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f3.e \
    -anchor w \
    -text {E} \
    -variable xfMisc(XYGraphAnchor) \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f3.se \
    -anchor w \
    -text {SE} \
    -variable xfMisc(XYGraphAnchor) \
    -command ""
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2.c select

  XFTmpltLabledEntry \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
      bg "Background:"

  XFTmpltLabledEntry \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
      bitmap "Bitmap:"

  XFTmpltLabledEntry \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
      color "Color:"

  XFTmpltLabledEntry \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
      font "Font:"

  XFTmpltLabledEntry \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
      fg "Foreground:"

  XFTmpltLabledEntry \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
      label "Label:"

  XFTmpltLabledEntry \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
      name "Line name:"

  XFTmpltScale \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
      linewidth "Line width:" "" 50

  XFTmpltLabledEntry \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
      posx "X position:"

  XFTmpltLabledEntry \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
      posy "Y position:"

  XFTmpltScale \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
      rotate "Rotation:" "" 360

  XFTmpltFrame \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym 0

  XFTmpltFrame \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1 0

  XFTmpltFrame \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym1 0

  XFTmpltFrame \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym2 0

  XFTmpltFrame \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym3 0

  XFTmpltFrame \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym4 0

  XFTmpltFrame \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym5 0

  label .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.message1 \
    -relief raised \
    -text {Symbol:}

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym1.circle \
    -text {circle} \
    -variable xfMisc(XYGraphSymbol) \
    -anchor w \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym1.cross \
    -text {cross} \
    -variable xfMisc(XYGraphSymbol) \
    -anchor w \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym2.dashed \
    -text {dashed} \
    -variable xfMisc(XYGraphSymbol) \
    -anchor w \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym2.diamond \
    -text {diamond} \
    -variable xfMisc(XYGraphSymbol) \
    -anchor w \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym3.dotted \
    -text {dotted} \
    -variable xfMisc(XYGraphSymbol) \
    -anchor w \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym3.plus \
    -text {plus} \
    -variable xfMisc(XYGraphSymbol) \
    -anchor w \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym4.point \
    -text {point} \
    -variable xfMisc(XYGraphSymbol) \
    -anchor w \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym4.solid \
    -text {solid} \
    -variable xfMisc(XYGraphSymbol) \
    -anchor w \
    -command ""

  radiobutton .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym5.square \
    -text {square} \
    -variable xfMisc(XYGraphSymbol) \
    -anchor w \
    -command ""
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym4.solid select

  XFTmpltScale .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
    symbolsize "Symbol size:" "" 100

  label \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.message6 \
      -relief raised \
      -text {Text:}

  XFTmpltText .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 text
  XFMiscSetTextHeight \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.text.text 5

  label \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.message3 \
      -relief raised \
      -text {X data:}

  XFTmpltText .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 xdata
  XFMiscSetTextHeight \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.xdata.xdata 5

  label \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.message4 \
      -relief raised \
      -text {Y data:}

  XFTmpltText .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 ydata
  XFMiscSetTextHeight \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.ydata.ydata 5

  label .xf${xfClass}Config5.params1.params2.frame1.children.message1 \
    -text {Items:}

  XFTmpltListbox .xf${xfClass}Config5.params1.params2.frame1.children items

  XFXYGraphReadXYGraph $xfW $xfClass

  case [lindex [.xf${xfClass}Config5.params1.params2.frame1.elements.elem1.message1 config -text] 4] in {
    {Tag} {
      .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.entries.m invoke 1
    }
    {default} {
      .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.entries.m invoke 0
    }
  }

  .xf${xfClass}Config5.leave.ok configure \
    -command "
      XFMiscSetSymbolicName $xfW \
        \[.xf${xfClass}Config5.params1.params2.symname.symname get\]
      destroy .xf${xfClass}Config5"

  .xf${xfClass}Config5.leave.apply configure \
    -command ""

  .xf${xfClass}Config5.leave.applyperm configure \
    -command ""

  .xf${xfClass}Config5.leave.cancel configure \
    -command "destroy .xf${xfClass}Config5"

  XFXYGraphSetItem $xfW $xfClass

  if {$tkVersion >= 3.0} {
    tk_menuBar .xf${xfClass}Config5.params1.params2.frame1.elements.elem1 \
               .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.entries
  } {
    tk_menus .xf${xfClass}Config5 \
             .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.entries
  }

  # bindings
  bind .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bg.bg $xfBind(configure) \
    "XFProcColorBox background .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bg.bg"

  bind .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap.bitmap $xfBind(configure) \
    "XFProcFSBoxPixmap .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap.bitmap"

  bind .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.color.color $xfBind(configure) \
    "XFProcColorBox color .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.color.color"

  bind .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.font.font $xfBind(configure) \
    "XFProcFontBox font .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.font.font"

  bind .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.fg.fg $xfBind(configure) \
    "XFProcColorBox foreground .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.fg.fg"

  bind .xf${xfClass}Config5.params1.params2.frame1.children.items.items $xfBind(select1) "
    XFBindSelectOne %W %y
    XFXYGraphSetItem $xfW $xfClass"
  bind .xf${xfClass}Config5.params1.params2.frame1.children.items.items <ButtonPress-1> "
    XFBindSelectOne %W %y
    XFXYGraphSetItem $xfW $xfClass"
  bind .xf${xfClass}Config5.params1.params2.frame1.children.items.items <Button1-Motion> "
    XFBindSelectOne %W %y
    XFXYGraphSetItem $xfW $xfClass"
  bind .xf${xfClass}Config5.params1.params2.frame1.children.items.items <Shift-ButtonPress-1> "
    XFBindSelectOne %W %y
    XFXYGraphSetItem $xfW $xfClass"
  bind .xf${xfClass}Config5.params1.params2.frame1.children.items.items <Shift-Button1-Motion> "
    XFBindSelectOne %W %y
    XFXYGraphSetItem $xfW $xfClass"

  # packing
  pack append .xf${xfClass}Config5.params1.params2.commands \
              .xf${xfClass}Config5.params1.params2.commands.insert {left fill expand} \
              .xf${xfClass}Config5.params1.params2.commands.modify {left fill expand} \
              .xf${xfClass}Config5.params1.params2.commands.delete {left fill expand}

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem1 \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.entries {left fillx} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.message1 {left fillx expand}

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f1 \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f1.nw {top fillx} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f1.w {top fillx} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f1.sw {top fillx}

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2 \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2.n {top fillx} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2.c {top fillx} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2.s {top fillx}

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f3 \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f3.ne {top fillx} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f3.e {top fillx} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f3.se {top fillx}

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f1 {left frame center} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2 {left frame center} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f3 {left frame center}

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.message1 {left frame center} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor {left frame center}

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym1 \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym1.circle {left fillx expand} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym1.cross {left fillx expand}
  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym2 \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym2.dashed {left fillx expand} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym2.diamond {left fillx expand}

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym3 \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym3.dotted {left fillx expand} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym3.plus {left fillx expand} \

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym4 \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym4.point {left fillx expand} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym4.solid {left fillx expand} \

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym5 \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym5.square {left fillx expand}

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1 \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym1 {top fillx} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym2 {top fillx expand} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym3 {top fillx expand} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym4 {top fillx expand} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym5 {top fillx expand}

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.message1 {left} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1 {left fill expand}

  pack append .xf${xfClass}Config5.params1.params2.frame1.elements \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem1 {top fill} \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 {top fill expand}

  pack append .xf${xfClass}Config5.params1.params2.frame1.children \
              .xf${xfClass}Config5.params1.params2.frame1.children.message1 {top frame center} \
              .xf${xfClass}Config5.params1.params2.frame1.children.items {left fill expand}

  place .xf${xfClass}Config5.params1.params2.frame1.elements \
    -in .xf${xfClass}Config5.params1.params2.frame1 \
    -relx 0 \
    -rely 0 \
    -relheight 1.0 \
    -relwidth 0.5

  place .xf${xfClass}Config5.params1.params2.frame1.children \
    -in .xf${xfClass}Config5.params1.params2.frame1 \
    -relx 0.5 \
    -rely 0 \
    -relheight 1.0 \
    -relwidth 0.5

  pack append .xf${xfClass}Config5.params1.params2 \
              .xf${xfClass}Config5.params1.params2.frame1 {top fill expand} \
              .xf${xfClass}Config5.params1.params2.commands {top fill}

  pack append .xf${xfClass}Config5.params1 \
              .xf${xfClass}Config5.params1.params2 {left fill expand}
  pack append .xf${xfClass}Config5 \
              .xf${xfClass}Config5.pathname {top fill frame center} \
              .xf${xfClass}Config5.leave {bottom fill} \
              .xf${xfClass}Config5.additional {bottom fill} \
              .xf${xfClass}Config5.params1 {top fill expand}

  XFBindFormConnect .xf${xfClass}Config5.params1.params2.frame1.elements.elem2

  XFEditSetStatus "Calling parameter setting for XYGraph...done"
}

##########
# Procedure: XFSaveSpecial.XYGraph
# Description: save xygraph
# Arguments: xfW - the widget
# Returns: none
# Sideeffects: none
##########
proc XFSaveSpecial.XYGraph {xfW} {

  set xfResult "\n  # build xygraph items $xfW\n"
  foreach xfCounter [$xfW names] {
#FIX
#    case [$xfW type $xfCounter] in {
#      {line} {
        append xfResult "  $xfW insert \{$xfCounter\}"
        foreach xfOptions [$xfW lineconfigure $xfCounter] {
          # only handle options with 5 items per option entry
          if {[llength $xfOptions] == 5} {
            if {"[lindex $xfOptions 3]" != "[lindex $xfOptions 4]"} {
              append xfResult " \\\n    [lindex $xfOptions 0] {[lindex $xfOptions 4]}"
            }
          }
        }
#      }
#    }
    append xfResult "\n"
  }
}

##########
# Procedure: XFXYGraphDeleteItem
# Description: delete item from xygraph
# Arguments: xfW - the widget
#            xfClass - the class we configure
# Returns: none
# Sideeffects: none
##########
proc XFXYGraphDeleteItem {xfW xfClass} {

  set xfCurSelected \
    [.xf${xfClass}Config5.params1.params2.frame1.children.items.items curselection]
  if {$xfCurSelected >= 0} {
    set xfTag \
      "[lrange [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCurSelected] 1 end]"
    if {[lindex [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCurSelected] 0] == "<tag>"} {
      catch "$xfW untag \{$xfTag\}"
    } {
      catch "$xfW delete \{$xfTag\}"
    }

    set xfCounter 0
    set xfLast \
      [.xf${xfClass}Config5.params1.params2.frame1.children.items.items size]
    if {"$xfLast" == "none"} {
      set xfLast -1
    }
    while {$xfCounter < $xfLast} {
      if {"$xfTag" == "[lrange [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCounter] 1 end]"} {
        .xf${xfClass}Config5.params1.params2.frame1.children.items.items \
          delete $xfCounter
      }
      incr xfCounter 1
    }
  }
}

##########
# Procedure: XFXYGraphInsertItem
# Description: insert item into xygraph
# Arguments: xfW - the widget
#            xfClass - the class we configure
#            xfIndex - the target location in the graph
# Returns: none
# Sideeffects: none
##########
proc XFXYGraphInsertItem {xfW xfClass {xfIndex ""}} {
  global xfMisc

  if {"$xfIndex" == ""} {
    set xfIndex end
  }
  set xfTag ""
  set xfTagName \
    [.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.tag.tag get]
  set xfCounter 0
  if {[lsearch [$xfW names] "$xfTagName"] >= 0} {
    XFProcError "There already exists an item named:\n$xfTagName"
  } {
    if {"$xfTagName" != ""} {
      case $xfMisc(XYGraphCurrentType) in {
        {<tag*} {
          if {[catch "$xfW newtag \{$xfTagName\} \
                [.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.posx.posx get] \
                [.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.posy.posy get]" xfResult]} {
            XFProcError "$xfResult"
            return
          } {
            XFXYGraphSetXYGraph5 $xfW "$xfTagName" <tag> 1 $xfClass
          }
        }
        {default} {
          $xfW insert "$xfTagName"
          XFXYGraphSetXYGraph5 $xfW "$xfTagName" <line> 1 $xfClass
        }
      }
      .xf${xfClass}Config5.params1.params2.frame1.children.items.items \
        insert end "$xfMisc(XYGraphCurrentType) $xfTagName"
      .xf${xfClass}Config5.params1.params2.frame1.children.items.items \
        select from $xfIndex 
      .xf${xfClass}Config5.params1.params2.frame1.children.items.items \
        select to $xfIndex 
    }
  }
}

##########
# Procedure: XFXYGraphModifyItem
# Description: modify item in graph
# Arguments: xfW - the widget
#            xfClass - the class we configure
# Returns: none
# Sideeffects: none
##########
proc XFXYGraphModifyItem {xfW xfClass} {

  set xfCurSelected \
    [.xf${xfClass}Config5.params1.params2.frame1.children.items.items curselection]
  if {$xfCurSelected >= 0} {
    XFXYGraphSetXYGraph5 $xfW \
      "[lrange [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCurSelected] 1 end]" \
      [lindex [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCurSelected] 0] 1 $xfClass
    .xf${xfClass}Config5.params1.params2.frame1.children.items.items \
      select from $xfCurSelected
    .xf${xfClass}Config5.params1.params2.frame1.children.items.items \
      select to $xfCurSelected
  }
}

##########
# Procedure: XFXYGraphReadXYGraph
# Description: read current xygraph, and insert it into the lists
# Arguments: xfW - the widget we configure 
#            xfClass - the class we configure
# Returns: none
# Sideeffects: none
##########
proc XFXYGraphReadXYGraph {xfW xfClass} {

  foreach xfCounter [$xfW names] {
    .xf${xfClass}Config5.params1.params2.frame1.children.items.items insert end "<line> $xfCounter"
  }
  if {[.xf${xfClass}Config5.params1.params2.frame1.children.items.items size] > 0} {
    .xf${xfClass}Config5.params1.params2.frame1.children.items.items \
      select from 0
    .xf${xfClass}Config5.params1.params2.frame1.children.items.items \
      select to 0
    XFXYGraphSetItem $xfW $xfClass
  }
}

##########
# Procedure: XFXYGraphSetItem
# Description: set item fields to values from currently selected item
# Arguments: xfW - the widget
#            xfClass - the class we configure
# Returns: none
# Sideeffects: none
##########
proc XFXYGraphSetItem {xfW xfClass} {
  global xfMisc

  set xfCurSelected \
    [.xf${xfClass}Config5.params1.params2.frame1.children.items.items curselection]
  if {$xfCurSelected >= 0} {
    case [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCurSelected] in {
      {<tag*} {
        set xfMisc(XYGraphCurrentType) "<tag>"
        .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.entries.m \
          entryconfigure 1 -state active
        XFXYGraphSetItems tag $xfClass
        .xf${xfClass}Config5.leave.apply configure \
          -command "
            XFXYGraphSetXYGraph5 $xfW \{[lrange [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCurSelected] 1 end]\} <tag> 1 $xfClass"
        .xf${xfClass}Config5.leave.applyperm configure \
          -command "
            XFXYGraphSetXYGraph5 $xfW \{[lrange [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCurSelected] 1 end]\} <tag> 0 $xfClass"
      }
      {default} {
        set xfMisc(XYGraphCurrentType) "<line>"
        .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.entries.m \
          entryconfigure 0 -state active
        XFXYGraphSetItems line $xfClass
        .xf${xfClass}Config5.leave.apply configure \
          -command "
            XFXYGraphSetXYGraph5 $xfW \{[lrange [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCurSelected] 1 end]\} <line> 1 $xfClass"
        .xf${xfClass}Config5.leave.applyperm configure \
          -command "
            XFXYGraphSetXYGraph5 $xfW \{[lrange [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCurSelected] 1 end]\} <line> 0 $xfClass"
      }
    }

    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.tag.tag \
      insert 0 \
        "[lrange [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCurSelected] 1 end]"
    if {[catch "$xfW lineconfigure \{[lrange [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCurSelected] 1 end]\}" xfResources]} {
      catch "$xfW tagconfigure \{[lrange [.xf${xfClass}Config5.params1.params2.frame1.children.items.items get $xfCurSelected] 1 end]\}" xfResources
    }
    foreach xfCounter $xfResources {
      # only handle options with 5 items per option entry
      if {[llength $xfCounter] == 5} {
        case [lindex $xfCounter 0] in {
          {-anchor} {
            case [lindex $xfCounter 4] in {
              {nw} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f1.nw select
              }
              {w} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f1.w select
              }
              {sw} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f1.sw select
              }
              {n} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2.n select
              }
              {c} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2.c select
              }
              {s} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2.s select
              }
              {ne} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f3.ne select
              }
              {e} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f3.e select
              }
              {se} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f3.se select
              }
            }
          }
          {-background} {
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bg.bg \
              delete 0 end
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bg.bg \
              insert 0 [lindex $xfCounter 4]
          }
          {-bitmap} {
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap.bitmap \
              delete 0 end
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap.bitmap \
              insert 0 [lindex $xfCounter 4]
          }
          {-color} {
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.color.color \
              delete 0 end
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.color.color \
              insert 0 [lindex $xfCounter 4]
          }
          {-font} {
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.font.font \
              delete 0 end
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.font.font \
              insert 0 [lindex $xfCounter 4]
          }
          {-foreground} {
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.fg.fg \
              delete 0 end
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.fg.fg \
              insert 0 [lindex $xfCounter 4]
          }
          {-label} {
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.label.label \
              delete 0 end
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.label.label \
              insert 0 [lindex $xfCounter 4]
          }
          {-line} {
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.name.name \
              delete 0 end
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.name.name \
              insert 0 [lindex $xfCounter 4]
          }
          {-linewidth} {
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.linewidth.linewidth \
              set [lindex $xfCounter 4]
          }
          {-rotation} {
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.rotate.rotate \
              set [lindex $xfCounter 4]
          }
          {-symbolsize} {
            .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.symbolsize.symbolsize \
              set [lindex $xfCounter 4]
          }
          {-symbol} {
            case [lindex $xfCounter 4] in {
              {circle} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym1.circle select
              }
              {cross} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym1.cross select
              }
              {dashed} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym2.dashed select
              }
              {diamond} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym2.diamond select
              }
              {dotted} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym3.dotted select
              }
              {plus} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym3.plus select
              }
              {point} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym4.point select
              }
              {solid} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym4.solid select
              }
              {square} {
                .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym5.square select
              }
            }
          }
          {-text} {
            XFMiscSetText \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.text.text \
                [lindex $xfCounter 4]
          }
          {-xdata} {
            XFMiscSetText \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.xdata.xdata \
                [lindex $xfCounter 4]
          }
          {-ydata} {
            XFMiscSetText \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.ydata.ydata \
                [lindex $xfCounter 4]
          }
          {-xydata} {
            set type 0
            set xfXData ""
            set xfYData ""
            foreach element [lindex $xfCounter 4] {
              if {$type == 0} {
                lappend xfXData $element
                set type 1
              } {
                lappend xfYData $element
                set type 0
              }
            }
            XFMiscSetText \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.xdata.xdata $xfXData
            XFMiscSetText \
              .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.ydata.ydata $xfYData
          }
        }
      }
    }
  }
}

##########
# Procedure: XFXYGraphSetItems
# Description: set item fields for currently selected widget
# Arguments: xfType - the type we want to edit
#            xfClass - the class we configure
# Returns: none
# Sideeffects: none
##########
proc XFXYGraphSetItems {xfType xfClass} {

  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.tag
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bg
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.color
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.font
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.fg
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.label
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.name
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.posx
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.posy
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.linewidth
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.rotate
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.symbolsize
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.message6
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.text
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.message3
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.xdata
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.message4
  pack unpack .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.ydata

  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.tag.tag \
    delete 0 end
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor.anchor.f2.c \
    select
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bg.bg \
    delete 0 end
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap.bitmap \
    delete 0 end
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.color.color \
    delete 0 end
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.font.font \
    delete 0 end
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.fg.fg \
    delete 0 end
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.label.label \
    delete 0 end
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.name.name \
    delete 0 end
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.linewidth.linewidth \
    set 0
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.posx.posx \
    delete 0 end
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.posy.posy \
    delete 0 end
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.rotate.rotate \
    set 0
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym.sym1.sym4.solid \
    select
  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.symbolsize.symbolsize \
    set 0
  XFMiscSetText \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.text.text
  XFMiscSetText \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.xdata.xdata
  XFMiscSetText \
    .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.ydata.ydata

  case $xfType in {
    {tag} {
      .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.message1 \
        configure -text "Tag"

      pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.tag {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.anchor {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bg {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.font {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.fg {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.name {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.posx {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.posy {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.rotate {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.message6 {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.text {top fillx}
    }
    {default} {
      .xf${xfClass}Config5.params1.params2.frame1.elements.elem1.message1 \
        configure -text "Line"

      pack append .xf${xfClass}Config5.params1.params2.frame1.elements.elem2 \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.tag {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.color {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.label {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.linewidth {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.sym {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.symbolsize {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.message3 {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.xdata {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.message4 {top fillx} \
                  .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.ydata {top fillx}
    }
  }
  XFBindFormConnect .xf${xfClass}Config5.params1.params2.frame1.elements.elem2
}

##########
# Procedure: XFXYGraphSetXYGraph4
# Description: set xygraph 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 XFXYGraphSetXYGraph4 {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 font \
    [.xf${xfClass}Config4.params1.params2.font.font get]
  XFMiscSetResource $xfW foreground \
    [.xf${xfClass}Config4.params1.params2.fg.fg 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]"
  }
  if {[.xf${xfClass}Config4.params1.params2.lpos.lpos1.lpos1 get] > 0 &&
      [.xf${xfClass}Config4.params1.params2.lpos.lpos2.lpos2 get] > 0} {
    XFMiscSetResource $xfW legendposition \
      "@[.xf${xfClass}Config4.params1.params2.lpos.lpos1.lpos1 get],[.xf${xfClass}Config4.params1.params2.lpos.lpos2.lpos2 get]"
  }
  XFMiscSetResource $xfW retrace $xfMisc(retrace)
  XFMiscSetResource $xfW showlegend $xfMisc(showlegend)
  XFMiscSetResource $xfW title \
    [.xf${xfClass}Config4.params1.params2.title.title get]
  XFMiscSetResource $xfW xlabel \
    [.xf${xfClass}Config4.params1.params2.xlabel.xlabel get]
  XFMiscSetResource $xfW xlog $xfMisc(xlogscale)
  XFMiscSetResource $xfW xstepsize \
    [.xf${xfClass}Config4.params1.params2.xstepsize.xstepsize get]
  XFMiscSetResource $xfW xsubticks \
    [.xf${xfClass}Config4.params1.params2.xsubticks.xsubticks get]
  XFMiscSetResource $xfW ylabel \
    [.xf${xfClass}Config4.params1.params2.ylabel.ylabel get]
  XFMiscSetResource $xfW ylog $xfMisc(ylogscale)
  XFMiscSetResource $xfW ystepsize \
    [.xf${xfClass}Config4.params1.params2.ystepsize.ystepsize get]
  XFMiscSetResource $xfW ysubticks \
    [.xf${xfClass}Config4.params1.params2.ysubticks.ysubticks get]
}

##########
# Procedure: XFXYGraphSetXYGraph5
# Description: set xygraph parameters
# Arguments: xfW - the widget
#            xfTag - the tag we modify
#            xfTagType - the type of the tag we modify
#            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 XFXYGraphSetXYGraph5 {xfW xfTag xfTagType xfType xfClass {xfParam1 ""}} {
  global xfConf
  global xfMisc

  if {$xfType == 0 && !$xfConf(applyParameters)} {
    return
  }
  if {"[info commands $xfW]" == ""} {
    return
  }
  XFMiscSetSymbolicName $xfW \
    [.xf${xfClass}Config5.params1.params2.symname.symname get]

  case $xfTagType in {
    {<tag>} {
      catch "$xfW tagconfigure \{$xfTag\} -anchor $xfMisc(XYGraphAnchor)"
      if {"[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bg.bg get]" != ""} {
        catch "$xfW tagconfigure \{$xfTag\} \
          -background \{[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bg.bg get]\}"
      }
      if {"[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap.bitmap get]" != ""} {
        if {"[string index [.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap.bitmap get] 0]" == "@"} {
          catch "$xfW tagconfigure \{$xfTag\} -bitmap \
            \{[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap.bitmap get]\}"
        } {
          if {[file exists [.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap.bitmap get]]} {
            catch "$xfW tagconfigure \{$xfTag\} -bitmap \
              \{@[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap.bitmap get]\}"
          } {
            catch "$xfW tagconfigure \{$xfTag\} -bitmap \
              \{[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.bitmap.bitmap get]\}"
          }
        }
      } {
        catch "$xfW tagconfigure \{$xfTag\} -bitmap {}"
      }
      if {"[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.font.font get]" != ""} {
        catch "$xfW tagconfigure \{$xfTag\} \
          -font \{[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.font.font get]\}"
      }
      if {"[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.fg.fg get]" != ""} {
        catch "$xfW tagconfigure \{$xfTag\} \
          -foreground \{[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.fg.fg get]\}"
      }
      catch "$xfW tagconfigure \{$xfTag\} \
        -line \{[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.name.name get]\}"
      catch "$xfW tagconfigure \{$xfTag\} \
        -rotation [.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.rotate.rotate get]"
      if {[XFMiscGetText .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.text.text] != ""} {
        catch "$xfW tagconfigure \{$xfTag\} \
          -text \{[XFMiscGetText .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.text.text]\}"
      }
    }
    {default} {
      if {"[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.color.color get]" != ""} {
        catch "$xfW lineconfigure \{$xfTag\} \
          -color \{[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.color.color get]\}"
      }
      catch "$xfW lineconfigure \{$xfTag\} \
        -linewidth [.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.linewidth.linewidth get] \
        -symbolsize [.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.symbolsize.symbolsize get] \
        -label \{[.xf${xfClass}Config5.params1.params2.frame1.elements.elem2.label.label get]\} \
        -symbol $xfMisc(XYGraphSymbol)"
      set xfXData [string trim [XFMiscGetText .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.xdata.xdata]]
      set xfYData [string trim [XFMiscGetText .xf${xfClass}Config5.params1.params2.frame1.elements.elem2.ydata.ydata]]
      if {"$xfXData" != "" && "$xfYData" != "" &&
          [expr [expr [llength $xfXData]+[llength $xfYData]]%2] == 0 &&
          [llength $xfXData] == [llength $xfYData]} {
        if {[catch "$xfW lineconfigure \{$xfTag\} \
               -xdata \{$xfXData\} -ydata \{$xfYData\}" xfResult]} {
          XFProcError "$xfResult"
        }
      }
    }
  }
}

# eof

