1#/***************************************************************************** 2# * 3# * Elmer, A Finite Element Software for Multiphysical Problems 4# * 5# * Copyright 1st April 1995 - , CSC - IT Center for Science Ltd., Finland 6# * 7# * This program is free software; you can redistribute it and/or 8# * modify it under the terms of the GNU General Public License 9# * as published by the Free Software Foundation; either version 2 10# * of the License, or (at your option) any later version. 11# * 12# * This program is distributed in the hope that it will be useful, 13# * but WITHOUT ANY WARRANTY; without even the implied warranty of 14# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15# * GNU General Public License for more details. 16# * 17# * You should have received a copy of the GNU General Public License 18# * along with this program (in file fem/GPL-2); if not, write to the 19# * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20# * Boston, MA 02110-1301, USA. 21# * 22# *****************************************************************************/ 23 24#******************************************************************************* 25#* 26#* PNG save utility routines 27#* 28#******************************************************************************* 29#* 30#* Author: Mikko Lyly 31#* 32#* Address: CSC - IT Center for Science Ltd. 33#* Keilaranta 14, P.O. BOX 405 34#* 02101 Espoo, Finland 35#* Tel. +358 0 457 2723 36#* Telefax: +358 0 457 2302 37#* EMail: Juha.Ruokolainen@csc.fi 38#* 39#* Date: 04 Oct 2007 40#* 41#* Modified by: 42#* 43#* Date of modification: 44#* 45#****************************************************************************** 46set PNGFileName "elmerpost.png" 47 48proc savepng.Control { } { 49 global savepng_control PNGFileName 50 51 set savepng_control .savepng_control 52 53 if { [winfo exists $savepng_control] } { 54 destroy $savepng_control.title 55 destroy $savepng_control.file 56 destroy $savepng_control.save_button 57 destroy $savepng_control.buttons 58 } else { 59 toplevel $savepng_control 60 place_window $savepng_control 61 } 62 63 wm title $savepng_control "Savepng control" 64 # 65 # File name: 66 # 67 frame $savepng_control.file 68 69 label $savepng_control.file.label -width 8 -text "File name:" 70 entry $savepng_control.file.name -width 30 -textvariable PNGFileName 71 button $savepng_control.file.button -text "Browse.." \ 72 -command { set PNGFileName [tk_getSaveFile -parent .savepng_control \ 73 -title "Save Picture To File"]; } 74 pack $savepng_control.file.label $savepng_control.file.name \ 75 $savepng_control.file.button -side left -expand 1 76 77 pack $savepng_control.file -expand 1 -fill both -side top 78 # 79 # Buttons: 80 # 81 frame $savepng_control.buttons 82 83 button $savepng_control.buttons.close -text "Close" \ 84 -command { destroy $savepng_control } 85 86 frame $savepng_control.save_button 87 button $savepng_control.save_button.save \ 88 -text "Save" -command { savepng $PNGFileName } 89 pack $savepng_control.save_button.save \ 90 -side left -expand 1 -fill x 91 92 pack $savepng_control.buttons.close -side right 93 94 pack $savepng_control.save_button -side top -expand 1 -fill x 95 pack $savepng_control.buttons -side top -fill x -expand 1 96} 97