[jp] Color printing weekly and monthly - patch against 0.99.7

Colin Brough Colin.Brough at blueyonder.co.uk
Mon Mar 1 06:39:20 EST 2004


> Save the attached patch file (colorpatch_0.99.7), cd into the 0.99.7
> directory, and apply the patch as follows:

Except I didn't :-( Sorry!

Attached now, and also available at:

	http://www.colinbrough.pwp.blueyonder.co.uk/jpilot/jpilot.html

Cheers

Colin

----------------------------------------------------------------------
Colin Brough                             Colin.Brough at blueyonder.co.uk
-------------- next part --------------
diff -Naur jpilot-0.99.7/print.c jpilot-0.99.7-cmb/print.c
--- jpilot-0.99.7/print.c	2003-12-08 02:23:17.000000000 +0000
+++ jpilot-0.99.7-cmb/print.c	2004-03-01 10:26:27.000000000 +0000
@@ -153,7 +153,7 @@
            "%%%%Page: 1 1\n\n",
 	   ctime(&ltime));
 
-   fprintf(out, "/PageSize (%s) def\n\n", PaperSizes[PAPER_Letter]);
+   fprintf(out, "/PageSize (%s) def\n\n", PaperSizes[PAPER_A4]);
    print_common_header(out);
    fprintf(out, "595 612 div 842 792 div Min dup scale %% HACK!!!! (CMB)\n");
            /* This hack pre-scales to compensate for the standard scaling
@@ -451,6 +451,7 @@
    if (! (out = print_open())) return(-1);
    fprintf(out, "%%!PS-Adobe-2.0\n\n"
 	   "/PageSize (%s) def\n\n", PaperSizes[paper_size]);
+   fprintf(out, "/Color true def\n");
    print_month_header(out);
 
    /*------------------------------------------------------------------
@@ -644,6 +645,7 @@
     *------------------------------------------------------------------*/
    fprintf(out, "%%!PS-Adobe-2.0\n\n"
 	   "/PageSize (%s) def\n\n", PaperSizes[paper_size]);
+   fprintf(out, "/Color true def\n");
    fprintf(out, "/FirstHour  9 def\n"
 	   "/LastHour  22 def\n");
    fprintf(out, "/Dashes true def\n");
@@ -686,7 +688,9 @@
 	   "%d %d %d %d %d startprinting\n\n",
 	   today_date->tm_mday, today_date->tm_mon + 1,
 	   today_date->tm_year + 1900, first_hour, last_hour);
-   fprintf(out, "( by %s version %s) show\n", PN, VERSION);
+   fprintf(out, "Color  { 0 0 1 setrgbcolor } if\n"
+	   "( by %s version %s) show\n"
+	   "Color { 0 0 0 setrgbcolor } if\n", PN, VERSION);
 
    print_logo(out, 20, 30, 0.35);
 
@@ -1113,7 +1117,7 @@
 #endif
 
    fprintf(out, "%%!PS-Adobe-2.0\n\n"
-           "/PageSize (%s) def\n\n", PaperSizes[PAPER_Letter]);
+           "/PageSize (%s) def\n\n", PaperSizes[PAPER_A4]);
    print_common_header(out);
    fprintf(out, "/CategoryName (%s) def\n", category_name);
    print_todo_header(out);
diff -Naur jpilot-0.99.7/print_headers.c jpilot-0.99.7-cmb/print_headers.c
--- jpilot-0.99.7/print_headers.c	2003-05-03 04:16:28.000000000 +0100
+++ jpilot-0.99.7-cmb/print_headers.c	2004-03-01 10:37:05.000000000 +0000
@@ -40,6 +40,7 @@
         "/Courier          /Courier-ISOLatin1 Recode\n"
         "/Courier-Bold     /Courier-Bold-ISOLatin1 Recode\n"
         "/Helvetica        /Helvetica-ISOLatin1 Recode\n"
+	"/Color where { pop } { /Color false def } ifelse\n"
         "/edef   { exch def } def\n"
         "/esub   { exch sub } def\n"
         "/l      { lineto } def\n"
@@ -203,10 +204,12 @@
         "        A4landscape\n"
         "        gsave\n"
         "        /Helvetica-Oblique findfont 8 scalefont setfont\n"
+        "        Color { 0 0 1 setrgbcolor } if\n"
         "        LM TM 5 add m (Printed on: ) show\n"
         "          Day nstr cvs show (/) show\n"
         "        Month nstr cvs show (/) show\n"
         "         Year nstr cvs show\n"
+        "        Color { 0 0 0 setrgbcolor } if\n"
         "        gsave\n"
         "        %----------------------------------------------------------\n"
         "        % Put the times, in 24 hour format, down the left hand edge\n"
@@ -412,8 +415,10 @@
         "    itemfont usefont\n"
         "    count 0 ne {\n"
         "        count 1 eq {\n"
+        "            Color { 1 0 0 setrgbcolor } if\n"
         "            /BotItemY BotItemY linespacing sub def\n"
         "            TodayLM 3 add BotItemY m show\n"
+        "            Color { 0 0 0 setrgbcolor } if\n"
         "        } {\n"
         "            { count 3 gt { concat } { exit } ifelse } loop\n"
         "            /Details        edef\n"
@@ -429,8 +434,9 @@
         "            TodayLM DayWidth add    HourFrom TimeToY2 l\n"
         "            TodayLM DayWidth add    HourTo   TimeToY2 l\n"
         "            TodayLM                 HourTo   TimeToY2 l\n"
-        "            closepath gsave 0.9 setgray fill\n"
-        "            grestore gsave 0 setgray stroke\n"
+        "            closepath gsave\n"
+        "            Color { 1 0.98 0.6 setrgbcolor } { 0.9 setgray } ifelse\n"
+        "            fill grestore gsave 0 setgray stroke\n"
         "            grestore clip\n"
         "\n"
         "            %----------------------------------------\n"
@@ -499,10 +505,13 @@
         "        %----------------------------------------------------------\n"
         "        % Draw various headings\n"
         "        /Helvetica-Bold findfont fontsize 3 mul scalefont setfont\n"
+        "        Color { 0 0 0 setrgbcolor } if\n"
         "        LM TM 30 sub RM MonthName CenterText\n"
         "        /Helvetica findfont fontsize 0.8 mul scalefont setfont\n"
+        "        Color { 0 0 1 setrgbcolor } if\n"
         "        LM TM 30 sub m (Printed on: ) show TodaysDate show\n"
         "        RM TM 30 sub JpilotVersion RightText\n"
+        "        Color { 0 0 0 setrgbcolor } if\n"
         "\n"
         "        %----------------------------------------------------------\n"
         "        % Now draw the seven days of week across top\n"
@@ -514,12 +523,15 @@
 	"        DaysOfWeek\n"
         "        {\n"
         "            /DayName edef\n"
-        "            0.5 setgray X Y BoxWidth 20 Rectangle fill\n"
-        "            0   setgray X Y BoxWidth 20 1 DrawBox\n"
-        "            1 setgray X Y 3 add X BoxWidth add DayName CenterText\n"
+        "            Color { 1 1 0.4 setrgbcolor } { 0.5 setgray } ifelse\n"
+        "            X Y BoxWidth 20 Rectangle fill\n"
+        "            Color { 0 0 0 setrgbcolor } { 0 setgray } ifelse\n"
+        "            X Y BoxWidth 20 1 DrawBox\n"
+        "            Color { 0 0 0 setrgbcolor } { 1 setgray } ifelse\n"
+        "            X Y 3 add X BoxWidth add DayName CenterText\n"
         "            /X X BoxWidth add def\n"
         "        } forall\n"
-        "        0 setgray\n"
+        "        Color { } { 0 setgray} ifelse\n"
         "\n"
         "        %----------------------------------------------------------\n"
         "        % Now draw all the empty, slightly gray boxes that are the\n"
@@ -530,7 +542,8 @@
         "            0 1 4 {\n"
         "                /Row edef\n"
         "                Col ColToX Row RowToY BoxWidth BoxHeight Rectangle\n"
-        "                gsave 0.95 setgray fill grestore 0 setgray stroke\n"
+        "                gsave Color { 1 1 0.85 setrgbcolor } { 0.95 setgray } ifelse\n"
+        "                fill grestore 0 setgray stroke\n"
         "            } for\n"
         "        } for\n"
 	"        /Col FirstDay FDOW 1 add sub def\n"
@@ -579,7 +592,9 @@
         "        /ApptText edef\n"
         "        Y Ytop2 gt { /Y Ytop2 def } if\n"
         "        /Helvetica-Oblique findfont fsize scalefont setfont\n"
+        "        Color { 0 0 1 setrgbcolor } if\n"
         "        X Y m show\n"
+        "        Color { 0 0 0 setrgbcolor } if\n"
         "        /Helvetica-ISOLatin1 findfont fsize scalefont setfont\n"
         "        X 4.2 fsize mul add Y m ApptText show\n"
         "        /Y Y fsize sub def\n"
@@ -588,7 +603,9 @@
         "/UntimedItem {\n"
         "        /ApptText edef\n"
         "        /Helvetica-ISOLatin1 findfont fsize scalefont setfont\n"
-        "        X 3 fsize mul add Y m ApptText show\n"
+        "        Color { 1 0 0 setrgbcolor } if\n"
+        "        X 4.2 fsize mul add Y m ApptText show\n"
+        "        Color { 0 0 0 setrgbcolor } if\n"
         "        /Y Y fsize sub def\n"
         "} def\n"
         "\n"
@@ -609,6 +626,7 @@
         "        /SmallBoxWidth .125 BoxWidth mul def\n"
         "        /SmallLeftMargin X1 .16 BoxWidth mul add def\n"
         "        /Helvetica-Bold findfont 10 scalefont setfont \n"
+        "        Color { 0 1 0 setrgbcolor } if\n"
         "        X1 Y2 12 sub X2 MonthName CenterText\n"
         "        /Helvetica-Bold findfont 8 scalefont setfont \n"
         "        /X SmallLeftMargin def\n"
@@ -619,6 +637,7 @@
         "                X S_row 1 sub RowToY 24 sub DayName RightText\n"
         "                /X X SmallBoxWidth add def\n"
         "        } forall\n"
+        "        Color { 0 0 0 setrgbcolor } if\n"
         "        /Helvetica findfont 8 scalefont setfont \n"
         "        /SmallRow 0 def\n"
         "        /SmallCol S_FDOM FDOW sub def\n"


More information about the Jpilot mailing list