# Module: PrintFunctions
# Tcl version: 7.3 (Tcl/Tk/XF)
# Tk version: 3.6
# XF version: $__lastrelease$
#

# module contents
global moduleList
global autoLoadList
set moduleList(PrintFunctions) { .top11 PrintFormCancel PrintFormHelp PrintFormPrint PrintFrame}
set autoLoadList(PrintFunctions) {1}

# procedures to show toplevel windows


# procedure to show window ShowWindow.top11
proc ShowWindow.top11 { args} {
# xf ignore me 7

  # build widget .top11
  if {"[info procs XFEdit]" != ""} {
    catch "XFDestroy .top11"
  } {
    catch "destroy .top11"
  }
  toplevel .top11 

  # Window manager configurations
  global tkVersion
  wm positionfrom .top11 ""
  wm sizefrom .top11 ""
  wm maxsize .top11 1000 768
  wm minsize .top11 10 10
  wm title .top11 {Printing Form}


  # build widget .top11.frame34
  frame .top11.frame34  -borderwidth {2}

  # build widget .top11.frame34.frame0
  frame .top11.frame34.frame0  -borderwidth {2} -relief {raised}

  # build widget .top11.frame34.frame0.label1
  label .top11.frame34.frame0.label1  -borderwidth {0} -text {Format}

  # build widget .top11.frame34.frame0.menubutton2
  menubutton .top11.frame34.frame0.menubutton2  -bitmap {question} -menu {.top11.frame34.frame0.menubutton2.m} -text {}

  # build widget .top11.frame34.frame0.menubutton2.m
  menu .top11.frame34.frame0.menubutton2.m 
  .top11.frame34.frame0.menubutton2.m add command -command {OptionButtonSet .top11.frame34.frame0} -label {text}
  .top11.frame34.frame0.menubutton2.m add command -command {OptionButtonSet .top11.frame34.frame0} -label {html}
  .top11.frame34.frame0.menubutton2.m add command -command {OptionButtonSet .top11.frame34.frame0} -label {postscript}

  # build widget .top11.frame34.frame0.value
  label .top11.frame34.frame0.value  -anchor {w} -relief {sunken} -text {text}

  # pack widget .top11.frame34.frame0
  pack append .top11.frame34.frame0  .top11.frame34.frame0.label1 {left frame center fill}  .top11.frame34.frame0.value {left frame center expand fill}  .top11.frame34.frame0.menubutton2 {right frame center fill} 

  # build widget .top11.frame34.frame35
  frame .top11.frame34.frame35  -borderwidth {2}

  # build widget .top11.frame34.frame35.radiobutton36
  radiobutton .top11.frame34.frame35.radiobutton36  -text {Printer} -value {Printer} -variable {OutputDevice}

  # build widget .top11.frame34.frame35.radiobutton37
  radiobutton .top11.frame34.frame35.radiobutton37  -text {File} -value {File} -variable {OutputDevice}

  # pack widget .top11.frame34.frame35
  pack append .top11.frame34.frame35  .top11.frame34.frame35.radiobutton36 {left frame center expand}  .top11.frame34.frame35.radiobutton37 {right frame center expand} 

  # build widget .top11.frame34.frame38
  frame .top11.frame34.frame38  -borderwidth {2}

  # build widget .top11.frame34.frame38.frame39
  frame .top11.frame34.frame38.frame39  -borderwidth {2}

  # build widget .top11.frame34.frame38.frame39.entry42
  entry .top11.frame34.frame38.frame39.entry42  -relief {sunken}

  # build widget .top11.frame34.frame38.frame39.label41
  label .top11.frame34.frame38.frame39.label41  -text {Printer Command:}

  # pack widget .top11.frame34.frame38.frame39
  pack append .top11.frame34.frame38.frame39  .top11.frame34.frame38.frame39.label41 {left frame center}  .top11.frame34.frame38.frame39.entry42 {right frame center} 

  # build widget .top11.frame34.frame38.frame40
  frame .top11.frame34.frame38.frame40  -borderwidth {2}

  # build widget .top11.frame34.frame38.frame40.button45
  button .top11.frame34.frame38.frame40.button45  -command {
  global fsBox
  set fsBox(showPixmap) 0
  set newfile [FSBox "Filename:" "print.text"]
  if {$newfile != {}} {
    [SN PrintFormFilename] delete 0 end
    [SN PrintFormFilename] insert end $newfile
  }} -text {Browse}

  # build widget .top11.frame34.frame38.frame40.entry44
  entry .top11.frame34.frame38.frame40.entry44  -relief {sunken}

  # build widget .top11.frame34.frame38.frame40.label43
  label .top11.frame34.frame38.frame40.label43  -text {Filename:}

  # pack widget .top11.frame34.frame38.frame40
  pack append .top11.frame34.frame38.frame40  .top11.frame34.frame38.frame40.label43 {left frame center}  .top11.frame34.frame38.frame40.entry44 {left frame center}  .top11.frame34.frame38.frame40.button45 {right frame center} 

  # pack widget .top11.frame34.frame38
  pack append .top11.frame34.frame38  .top11.frame34.frame38.frame39 {top frame center fillx}  .top11.frame34.frame38.frame40 {top frame center fillx} 

  # pack widget .top11.frame34
  pack append .top11.frame34  .top11.frame34.frame35 {top frame center fillx}  .top11.frame34.frame38 {top frame center fillx}  .top11.frame34.frame0 {top frame center fillx} 

  # build widget .top11.frame46
  frame .top11.frame46  -borderwidth {2}

  # build widget .top11.frame46.button47
  button .top11.frame46.button47  -command {PrintFormPrint} -text {Print}

  # build widget .top11.frame46.button48
  button .top11.frame46.button48  -command {PrintFormCancel} -text {Cancel}

  # build widget .top11.frame46.button49
  button .top11.frame46.button49  -command {PrintFormHelp} -text {Help}

  # pack widget .top11.frame46
  pack append .top11.frame46  .top11.frame46.button47 {left frame center expand}  .top11.frame46.button48 {left frame center expand}  .top11.frame46.button49 {right frame center expand} 

  # build widget .top11.label33
  label .top11.label33  -font {-Adobe-Helvetica-Bold-R-Normal--*-240-*} -text {Printing A Form}

  # pack widget .top11
  pack append .top11  .top11.label33 {top frame center}  .top11.frame34 {top frame center expand fillx}  .top11.frame46 {top frame center fillx} 

  if {"[info procs XFEdit]" != ""} {
    XFEditSetShowWindows
    XFMiscBindWidgetTree .top11
  }

  .top11.frame34.frame38.frame39.entry42 insert end {|lpr}
  .top11.frame34.frame38.frame40.entry44 insert end {print.text}
}

proc DestroyWindow.top11 {} {# xf ignore me 7
  if {"[info procs XFEdit]" != ""} {
    if {"[info commands .top11]" != ""} {
      global xfShowWindow.top11
      set xfShowWindow.top11 0
      XFEditSetPath .
      after 200 "XFSaveAsProc .top11; XFEditSetShowWindows"
    }
  } {
    catch "destroy .top11"
    update
  }
}


# User defined procedures


# Procedure: PrintFormCancel
proc PrintFormCancel {} {
  DestroyWindow[SN PrintForm]
}


# Procedure: PrintFormHelp
proc PrintFormHelp {} {
  PopupHelpTopic PrintForm
}


# Procedure: PrintFormPrint
proc PrintFormPrint {} {
  set filename [[SN PrintFormFilename] get]
  set printer  [[SN PrintFormPrinter] get]
  set mode     [lindex [[SN PrintFormMode] configure -text] 4]
  DestroyWindow[SN PrintForm]
  global OutputDevice
  global CurrentFrame
  case $CurrentFrame in {
    {CharacterFrame} {
      global CurrentCharacter
      if {$CurrentCharacter(handle) != {}} {
	case $OutputDevice in {
	  {Printer} {
	    $CurrentCharacter(handle) print $printer $mode
	  }
	  {File} {
	    $CurrentCharacter(handle) print $filename $mode
	  }
	}
      }
    }
    {MonsterFrame} {
      global CurrentMonster
      if {$CurrentMonster(handle) != {}} {
	case $OutputDevice in {
	  {Printer} {
	    $CurrentMonster(handle) print $printer $mode
	  }
	  {File} {
	    $CurrentMonster(handle) print $filename $mode
	  }
	}
      }
    }
    {MasterFrame} {
      global MasterMode
      global CurrentMasterDungeon
      global CurrentMasterGame
      if {$MasterMode == "Build"} {
	if {$CurrentMasterDungeon(handle) != {}} {
	  case $OutputDevice in {
	    {Printer} {
	      $CurrentMasterDungeon(handle) print $printer $mode
	    }
	    {File} {
	      $CurrentMasterDungeon(handle) print $filename $mode
	    }
	  }
	}
      } else {
        if {$CurrentMasterGame(handle) != {}} {
	  case $OutputDevice in {
	    {Printer} {
	      $CurrentMasterGame(handle) print $printer $mode
	    }
	    {File} {
	      $CurrentMasterGame(handle) print $filename $mode
	    }
	  }
	}
      }
    }
  }
}


# Procedure: PrintFrame
proc PrintFrame {} {
  ShowWindow[SN PrintForm]
}


# Internal procedures

# eof
#

