Source

IDO / perl / ido-cal-pages.pl

The default branch has multiple heads

Full commit
mittelmark f7a683f 










































































































# -*- perl -*- ###############################################################
#
#  			Copyright 2009 Dr. Detlef Groth
#			      All Rights Reserved
#
#
#  System        : 
#  Module        : 
#  Object Name   : $RCSfile:$
#  Revision      : $Revision:$
#  Date          : $Date:$
#  Author        : $Author:$
#  Created By    : Dr. Detlef Groth
#  Created       : Tue Apr 28 05:48:55 2009
#  Last Modified : <090428.0620>
#
#  Description	
#
#  Notes
#
#  History
#	
##############################################################################
#
#  Copyright (c) 2009 Dr. Detlef Groth
# 
#  All Rights Reserved.
# 
#  This  document  may  not, in  whole  or in  part, be  copied,  photocopied,
#  reproduced,  translated,  or  reduced to any  electronic  medium or machine
#  readable form without prior written consent from Potsdam University.
#
##############################################################################

use strict;
use PDF::Reuse;
sub drawLine {
    my $x1 = shift ;
    my $y1 = shift ;
    my $x2 = shift;
    my $y2 = shift;
    my $col = shift || "0.1 0.1 0.1";
    my $lw = shift || 0.5 ;
    my $dashed = shift;
    prAdd("$col RG\n");
    prAdd("$lw w\n");
    if ($dashed) {
        prAdd("[2 2] 0 d\n"); # a dashed line 0.5 points large
    }
    prAdd("$x1 $y1 m\n");
    prAdd("$x2 $y2 l\n");
    prAdd("S\n"); 
    if ($dashed) {
        prAdd("[] 0 d\n"); # reset dash
    }
    
    
}
sub drawLines {
    my $dir = shift || "left" ;
    my $start = 0 ;
    my $strong = 0.5 ;
    my $bot = 50 ;
    my $indent = 0 ;
    my $dh = 105;
    if ($dir ne "left") {
        $start = 6 ;
    }
    # horizontal strong lines
    for (my $y = 0; $y < 8; $y++) {
        if ($y == 0 || $y == 3) {
            $strong = 2 ;
        } else {
            $strong = 2 ;
        }
        
        drawLine(50,$bot+$y*$dh,550,$bot+$y*$dh,"0.0 0.0 0.0",$strong);
    }
    # vertical lines
    if ($dir eq "right") {
        drawLine(550,$bot+7*$dh,550,$bot,"0 0 0",2);
        drawLine(450,$bot+7*$dh,450,$bot,"0 0 0");
        drawLine(420,$bot+7*$dh,420,$bot,"0 0 0");
        drawLine(50,$bot+7*$dh,50,$bot,"0 0 0",2);

    } else {
        drawLine(50,$bot+7*$dh,50,$bot,"0 0 0",2);
        drawLine(150,$bot+7*$dh,150,$bot,"0 0 0");
        drawLine(180,$bot+7*$dh,180,$bot,"0 0 0");
        drawLine(550,$bot+7*$dh,550,$bot,"0 0 0",2);
    }
    for (my $y = 0; $y < 7; $y++) {
        if ($dir eq "left") {
            drawLine(150,$bot+$y*$dh+35,550,$bot+$y*$dh+35,"0.0 0.0 0.0",0.5,1);
            drawLine(150,$bot+$y*$dh+70,550,$bot+$y*$dh+70,"0.0 0.0 0.0",0.5,1);
        } else {
            drawLine(50,$bot+$y*$dh+35,450,$bot+$y*$dh+35,"0.0 0.0 0.0",0.5,1);
            drawLine(50,$bot+$y*$dh+70,450,$bot+$y*$dh+70,"0.0 0.0 0.0",0.5,1);
        }
    }
}
prFile("calendar-lines.pdf");
prPage();
drawLines("right");
prPage();
drawLines("left");
prEnd();