diff --git a/scripts/tkremind.in b/scripts/tkremind.in index f5275499..3cba06d4 100644 --- a/scripts/tkremind.in +++ b/scripts/tkremind.in @@ -442,7 +442,7 @@ proc Initialize {} { set TodayDay [string trim [clock format $now -format %e]] set CommandLine "$Remind -itkremind=1 -ppp%WEEKS% -y -l %EXTRA%" - set PSCmd "$Remind -itkremind=1 -itkprint=1 -pp -l %EXTRA%" + set PSCmd "$Remind -itkremind=1 -itkprint=1 -pp%WEEKS% -l %EXTRA%" set i 0 while {$i < $argc} { if {[regexp -- {-[bgxim].*} [lindex $argv $i]]} { @@ -1663,9 +1663,15 @@ proc DoPrint {} { proc DoPrintHelper {} { global Rem2PS Rem2PDF HaveRem2PDF PSCmd Option PrintStatus RemindErrors - global CudRday CurMonth CurYear MonthNames + global CurDay CurMonth CurYear MonthNames catch {destroy .p} + + if {$Option(View) != "Month" && ! $HaveRem2PDF} { + tk_messageBox -message "rem2pdf was not found, but is required to print weekly calendars" -icon error -type ok + return + } + toplevel .p bind .p [list raise .p] @@ -1780,15 +1786,21 @@ proc DoPrintHelper {} { set fname "| $cmd" } - if {$HaveRem2PDF && $Option(PrintFormat) == "pdf"} { - set p [regsub %EXTRA% $PSCmd "-itkpdf=1 $Option(ExtraRemindArgs)"] - set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PDF" - } elseif {$HaveRem2PDF && $Option(PrintFormat) == "ps1"} { - set p [regsub %EXTRA% $PSCmd "-itkpdf=1 $Option(ExtraRemindArgs)"] - set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PDF --ps" + set p $PSCmd + if {"$Option(View)" == "Month"} { + set p [regsub %WEEKS% $PSCmd ""] } else { - set p [regsub %EXTRA% $PSCmd $Option(ExtraRemindArgs)] - set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PS" + set p [regsub %WEEKS% $PSCmd "+[get_num_weeks]"] + } + if {$HaveRem2PDF && $Option(PrintFormat) == "pdf"} { + set p [regsub %EXTRA% $p "-itkpdf=1 $Option(ExtraRemindArgs)"] + set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PDF --weeks-per-page=[get_num_weeks]" + } elseif {$HaveRem2PDF && $Option(PrintFormat) == "ps1"} { + set p [regsub %EXTRA% $p "-itkpdf=1 $Option(ExtraRemindArgs)"] + set cmd "$p 1 [lindex $MonthNames $CurMonth] $CurYear | $Rem2PDF --ps --weeks-per-page=[get_num_weeks]" + } else { + set p [regsub %EXTRA% $p $Option(ExtraRemindArgs)] + set cmd "$p $CurDay [lindex $MonthNames $CurMonth] $CurYear | $Rem2PS" set Option(PrintFormat) ps }