splash.tcl 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. #----------------------------------------------------------------
  2. #
  3. # splash.tcl
  4. #
  5. # TNT splash window
  6. #
  7. # Create and display the requested toplevel splash window.
  8. # Closing the window just withdraws it, so it can be
  9. # deiconified later, as a sort of "help about" screen.
  10. #
  11. # Bob Techentin
  12. # January 21, 2004
  13. # Copyright Mayo Foundation, 2004. All Rights Reserved
  14. #
  15. # $Id: splash.tcl,v 1.5 2004/07/22 13:16:21 techenti Exp $
  16. #
  17. #----------------------------------------------------------------
  18. proc ::gui::splash { w } {
  19. # Toplevel is already created. Manage it here.
  20. wm withdraw $w
  21. wm protocol $w WM_DELETE_WINDOW [list wm withdraw $w]
  22. wm title $w "Mayo SPPDG Transmission Line Modeling Suite"
  23. $w configure -background white
  24. # create components of the splash screen
  25. image create photo img1 -file [file join $::gui::LIBRARY MayoSPPDGlogo.gif]
  26. set lab0 [label $w.logo -image img1]
  27. set lab1 [label $w.label1 -justify center -font {Helvetica 36} \
  28. -text "TNT $::TNT_VERSION"]
  29. set lab2 [label $w.label2 -justify center -font {Helvetica 20} -text \
  30. "Transmission Line Electromagnetic Modeling Tool Suite"]
  31. set lab3 [label $w.label3 -justify left -font {Helvetica 12} -text \
  32. "Copyright Mayo Foundation 2002-2004. All Rights Reserved."]
  33. set lab4 [label $w.label4 -justify left -font {Helvetica 10} \
  34. -wraplength 30c -text \
  35. "TNT comes with ABSOLUTELY NO WARRANTY. This is free software,
  36. licensed under the GNU General Public License, and you are welcome to
  37. redistribute it under certain conditions. See the license for details."]
  38. # Pack 'em up, and make it look nice
  39. foreach widget [list $lab0 $lab1 $lab2 $lab3 $lab4] {
  40. pack $widget -padx 20 -pady 20 -side top
  41. $widget configure -background white -borderwidth 0
  42. }
  43. pack $lab0 -anchor w
  44. # Create 'close' and 'show license' buttons
  45. set bf [frame $w.buttonframe -background white]
  46. set closeb [button $bf.closeb -text "Close" -background white\
  47. -command [list wm withdraw $w]]
  48. set licenseb [button $bf.licenseb -text "Show License" -background white \
  49. -command [list ::gui::showLicense]]
  50. grid $closeb $licenseb -padx 20 -pady 20 -sticky news
  51. grid columnconfigure $bf {0 1} -weight 1 -uniform 1
  52. pack $bf -side top
  53. # center the splash screen
  54. update idletasks
  55. set x [expr {[winfo screenwidth $w]/2 - [winfo reqwidth $w]/2 \
  56. - [winfo vrootx [winfo parent $w]]}]
  57. set y [expr {[winfo screenheight $w]/2 - [winfo reqheight $w]/2 \
  58. - [winfo vrooty [winfo parent $w]]}]
  59. wm geom $w +$x+$y
  60. wm deiconify $w
  61. update
  62. }
  63. proc ::gui::showLicense {} {
  64. # License file, COPYING, should be installed
  65. # just above the bin directory in $::scriptDir,
  66. # but in "developer mode," it is found in
  67. # $::scriptDir.
  68. if { $::tcl_platform(platform) eq "windows" } {
  69. set filename COPYING.txt
  70. } else {
  71. set filename COPYING
  72. }
  73. set licenseFile [file join $::scriptDir ../share/tnt-mmtl $filename]
  74. if { [file exists $licenseFile] } {
  75. ::gui::guiPopupFile $licenseFile
  76. } else {
  77. set licenseFile [file join $::scriptDir $filename]
  78. if { [file exists $licenseFile] } {
  79. ::gui::guiPopupFile $licenseFile
  80. } else {
  81. tk_messageBox -message "License file 'COPYING' not found."
  82. }
  83. }
  84. }