[GRASS-SVN] r29490 - grass/trunk/gui/tcltk/gis.m
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Dec 20 22:42:32 EST 2007
Author: cmbarton
Date: 2007-12-20 22:42:32 -0500 (Thu, 20 Dec 2007)
New Revision: 29490
Modified:
grass/trunk/gui/tcltk/gis.m/mapprint.tcl
Log:
Code cleanup cosmetics. Test of commit privileges 2.
Modified: grass/trunk/gui/tcltk/gis.m/mapprint.tcl
===================================================================
--- grass/trunk/gui/tcltk/gis.m/mapprint.tcl 2007-12-21 01:22:17 UTC (rev 29489)
+++ grass/trunk/gui/tcltk/gis.m/mapprint.tcl 2007-12-21 03:42:32 UTC (rev 29490)
@@ -95,7 +95,7 @@
set cmd "gs"
}
- #enable additional printing options if Ghostscript available
+ #enable additional printing options if Ghostscript available
if {![catch {set input [exec $cmd -help]} error]} {
regexp ".*Available devices:(.*)Search path:" $input string gsdevices
set gsstate "normal"
@@ -105,7 +105,7 @@
} else {
set gsdevices "none available"
set gsstate "disabled"
- # set printmode "eps"
+ #set printmode "eps"
tk_messageBox -type ok -icon error -message [G_msg "Ghostscript not available"]
}
}
@@ -125,7 +125,7 @@
variable docht
variable orient
- # set paper dimensions
+ # set paper dimensions
if { $paper == "preset" } {
switch $paper_preset {
"11x17" {
@@ -237,135 +237,135 @@
variable gsstate
global mon
- set mon $cm
+ set mon $cm
+
+ # check if opened
+ if { [winfo exists .printwin] } {
+ wm deiconify .printwin
+ raise .printwin
+ return
+ }
- # check if opened
- if { [winfo exists .printwin] } {
- wm deiconify .printwin
- raise .printwin
- return
- }
-
- set PW [toplevel .printwin]
- wm title $PW [G_msg "Postscript and LPR printing of map display"]
-
- # Left part paper + output
- set PWid(left) [ frame $PW.left -padx 5 -pady 5]
- pack $PWid(left) -side left -anchor w
-
- # paper size, scale
- set PWid(paper) [ frame $PWid(left).paper]
- pack $PWid(paper) -side top -anchor w
-
- # preset paper sizes (from ghostscript)
- set row [ frame $PWid(paper).row1 ]
- radiobutton $row.a -variable psprint::paper -value "preset" \
- -highlightthickness 0
- Label $row.b -anchor w -text [G_msg "Preset paper type"]
- ComboBox $row.c -label "" -width 20 -textvariable psprint::paper_preset \
- -values {"letter" "a4" "legal" "11x17" "a3" "ledger" "a0" "a1" "a2" } \
- -modifycmd psprint::paper
- pack $row.a $row.b $row.c -side left;
- pack $row -side top -fill x -expand no -anchor n
-
- # custom paper sizes
- set row [ frame $PWid(paper).row2 ]
- radiobutton $row.a -variable psprint::paper -value "custom" \
- -highlightthickness 0
- Label $row.b -anchor w -text [G_msg "Custom paper size"]
- Label $row.c -anchor w -text [G_msg "width:"]
- Entry $row.d -width 10 -textvariable psprint::pgwd
- Label $row.e -anchor w -text [G_msg " height:"]
- Entry $row.f -width 10 -textvariable psprint::pght
- pack $row.a $row.b $row.c $row.d $row.e $row.f -side left;
- pack $row -side top -fill x -expand no -anchor n
-
+ set PW [toplevel .printwin]
+ wm title $PW [G_msg "Postscript and LPR printing of map display"]
+
+ # Left part paper + output
+ set PWid(left) [ frame $PW.left -padx 5 -pady 5]
+ pack $PWid(left) -side left -anchor w
+
+ # paper size, scale
+ set PWid(paper) [ frame $PWid(left).paper]
+ pack $PWid(paper) -side top -anchor w
+
+ # preset paper sizes (from ghostscript)
+ set row [ frame $PWid(paper).row1 ]
+ radiobutton $row.a -variable psprint::paper -value "preset" \
+ -highlightthickness 0
+ Label $row.b -anchor w -text [G_msg "Preset paper type"]
+ ComboBox $row.c -label "" -width 20 -textvariable psprint::paper_preset \
+ -values {"letter" "a4" "legal" "11x17" "a3" "ledger" "a0" "a1" "a2" } \
+ -modifycmd psprint::paper
+ pack $row.a $row.b $row.c -side left;
+ pack $row -side top -fill x -expand no -anchor n
+
+ # custom paper sizes
+ set row [ frame $PWid(paper).row2 ]
+ radiobutton $row.a -variable psprint::paper -value "custom" \
+ -highlightthickness 0
+ Label $row.b -anchor w -text [G_msg "Custom paper size"]
+ Label $row.c -anchor w -text [G_msg "width:"]
+ Entry $row.d -width 10 -textvariable psprint::pgwd
+ Label $row.e -anchor w -text [G_msg " height:"]
+ Entry $row.f -width 10 -textvariable psprint::pght
+ pack $row.a $row.b $row.c $row.d $row.e $row.f -side left;
+ pack $row -side top -fill x -expand no -anchor n
+
#margins
- set row [ frame $PWid(paper).row3]
- Label $row.a -anchor w -text [G_msg "Margins left:"]
- Entry $row.b -width 10 -textvariable psprint::mleft
- Label $row.c -anchor w -text [G_msg " right:"]
- Entry $row.d -width 10 -textvariable psprint::mright
- Label $row.e -anchor w -text [G_msg " top:"]
- Entry $row.f -width 10 -textvariable psprint::mtop
- Label $row.g -anchor w -text [G_msg " bottom:"]
- Entry $row.h -width 10 -textvariable psprint::mbottom
-
- pack $row.a $row.b $row.c $row.d $row.e $row.f $row.g $row.h -side left;
+ set row [ frame $PWid(paper).row3]
+ Label $row.a -anchor w -text [G_msg "Margins left:"]
+ Entry $row.b -width 10 -textvariable psprint::mleft
+ Label $row.c -anchor w -text [G_msg " right:"]
+ Entry $row.d -width 10 -textvariable psprint::mright
+ Label $row.e -anchor w -text [G_msg " top:"]
+ Entry $row.f -width 10 -textvariable psprint::mtop
+ Label $row.g -anchor w -text [G_msg " bottom:"]
+ Entry $row.h -width 10 -textvariable psprint::mbottom
+
+ pack $row.a $row.b $row.c $row.d $row.e $row.f $row.g $row.h -side left;
pack $row -side top -fill x -expand no -anchor n
-
- # portrait or landscape
- set row [ frame $PWid(paper).row4 ]
- LabelEntry $row.a -label [G_msg "Resolution (dpi) for printing and PDF "] \
+
+ # portrait or landscape
+ set row [ frame $PWid(paper).row4 ]
+ LabelEntry $row.a -label [G_msg "Resolution (dpi) for printing and PDF "] \
-textvariable psprint::res -width 4
- Label $row.b -anchor w -text " "
- radiobutton $row.c -variable psprint::orient -value "landscape" \
+ Label $row.b -anchor w -text " "
+ radiobutton $row.c -variable psprint::orient -value "landscape" \
-text "landscape mode" -highlightthickness 0
- radiobutton $row.d -variable psprint::orient -value "portrait" \
+ radiobutton $row.d -variable psprint::orient -value "portrait" \
-text "portrait mode " -highlightthickness 0
- pack $row.a $row.b $row.c $row.d -side left;
- pack $row -side top -fill x -expand no -anchor n
-
- # output options
- set PWid(output) [ frame $PWid(left).output ]
- pack $PWid(output) -side top -anchor w
-
- # LPR printer
- set row [ frame $PWid(output).lpr ]
- radiobutton $row.a -variable psprint::printmode -value "lpr" \
- -highlightthickness 0
- Label $row.b -anchor w -text [G_msg "Print on LPR printer"]
- pack $row.a $row.b -side left;
- pack $row -side top -fill x -expand no -anchor n
-
- # Postscript printer
- set row [ frame $PWid(output).psprinter ]
- radiobutton $row.a -variable psprint::printmode -value "psprint" \
- -state $psprint::gsstate -highlightthickness 0
- Label $row.b -anchor w -text [G_msg "Print on postscript device* "] \
- -state $psprint::gsstate
- ComboBox $row.c -width 20 -textvariable psprint::printer \
- -values $psprint::gsdevices -editable 0 -entrybg white
- pack $row.a $row.b $row.c -side left;
- pack $row -side top -fill x -expand no -anchor n
-
- # PDF file
- set row [ frame $PWid(output).pdffile]
- radiobutton $row.a -variable psprint::printmode -value "pdf" \
- -state $psprint::gsstate -highlightthickness 0
- Label $row.b -anchor w -text [G_msg "Save to PDF file* "] \
- -state $psprint::gsstate
- Entry $row.c -width 30 -textvariable psprint::pdffile -state $gsstate
- Button $row.d -text [G_msg "Browse"] -command { set psprint::pdffile \
+ pack $row.a $row.b $row.c $row.d -side left;
+ pack $row -side top -fill x -expand no -anchor n
+
+ # output options
+ set PWid(output) [ frame $PWid(left).output ]
+ pack $PWid(output) -side top -anchor w
+
+ # LPR printer
+ set row [ frame $PWid(output).lpr ]
+ radiobutton $row.a -variable psprint::printmode -value "lpr" \
+ -highlightthickness 0
+ Label $row.b -anchor w -text [G_msg "Print on LPR printer"]
+ pack $row.a $row.b -side left;
+ pack $row -side top -fill x -expand no -anchor n
+
+ # Postscript printer
+ set row [ frame $PWid(output).psprinter ]
+ radiobutton $row.a -variable psprint::printmode -value "psprint" \
+ -state $psprint::gsstate -highlightthickness 0
+ Label $row.b -anchor w -text [G_msg "Print on postscript device* "] \
+ -state $psprint::gsstate
+ ComboBox $row.c -width 20 -textvariable psprint::printer \
+ -values $psprint::gsdevices -editable 0 -entrybg white
+ pack $row.a $row.b $row.c -side left;
+ pack $row -side top -fill x -expand no -anchor n
+
+ # PDF file
+ set row [ frame $PWid(output).pdffile]
+ radiobutton $row.a -variable psprint::printmode -value "pdf" \
+ -state $psprint::gsstate -highlightthickness 0
+ Label $row.b -anchor w -text [G_msg "Save to PDF file* "] \
+ -state $psprint::gsstate
+ Entry $row.c -width 30 -textvariable psprint::pdffile -state $gsstate
+ Button $row.d -text [G_msg "Browse"] -command { set psprint::pdffile \
[tk_getSaveFile -title "Output PDF file" -defaultextension ".pdf"]} \
- -state $psprint::gsstate
- pack $row.a $row.b $row.c $row.d -side left;
- pack $row -side top -fill x -expand no -anchor n
-
- # EPS file
- set row [ frame $PWid(output).epsfile ]
- radiobutton $row.a -variable psprint::printmode -value "eps" \
- -highlightthickness 0
- Label $row.b -anchor w -text [G_msg "Save to EPS file "]
- Entry $row.c -width 30 -textvariable psprint::epsfile
- Button $row.d -text [G_msg "Browse"] -command { set psprint::epsfile \
- [ tk_getSaveFile -title "Output EPS file" -defaultextension ".eps"] }
- pack $row.a $row.b $row.c $row.d -side left;
- pack $row -side top -fill x -expand no -anchor n
-
+ -state $psprint::gsstate
+ pack $row.a $row.b $row.c $row.d -side left;
+ pack $row -side top -fill x -expand no -anchor n
+
+ # EPS file
+ set row [ frame $PWid(output).epsfile ]
+ radiobutton $row.a -variable psprint::printmode -value "eps" \
+ -highlightthickness 0
+ Label $row.b -anchor w -text [G_msg "Save to EPS file "]
+ Entry $row.c -width 30 -textvariable psprint::epsfile
+ Button $row.d -text [G_msg "Browse"] -command { set psprint::epsfile \
+ [ tk_getSaveFile -title "Output EPS file" -defaultextension ".eps"] }
+ pack $row.a $row.b $row.c $row.d -side left;
+ pack $row -side top -fill x -expand no -anchor n
+
set row [ frame $PWid(output).gsmessage ]
- Label $row.a -anchor w -text [G_msg "*requires ghostscript to be installed and in path"]
- pack $row.a -side bottom;
- pack $row -side top -fill x -expand yes -anchor center
+ Label $row.a -anchor w -text [G_msg "*requires ghostscript to be installed and in path"]
+ pack $row.a -side bottom;
+ pack $row -side top -fill x -expand yes -anchor center
+
+ # Buttons
+ set but [ frame $PWid(left).buttons ]
+ pack $but -side top
+
+ Button $but.print -text [G_msg "Print"] -command "update; psprint::print $cv"
+ Button $but.close -text [G_msg "Close"] -command { destroy .printwin }
+ pack $but.print $but.close -side left
-# Buttons
- set but [ frame $PWid(left).buttons ]
- pack $but -side top
-
- Button $but.print -text [G_msg "Print"] -command "update; psprint::print $cv"
- Button $but.close -text [G_msg "Close"] -command { destroy .printwin }
- pack $but.print $but.close -side left
-
}
proc psprint::print { cv } {
More information about the grass-commit
mailing list