1 /*
2  * Copyright (c) Tony Bybell 1999.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  */
9 
10 #include "globals.h"
11 
12 /*
13  * This module has been re-implemented by Udi Finkelstein.
14  * Since it is no longer a PostScript-only module, it had been
15  * renamed "print.c".
16  *
17  * Much of the code has been "C++"-ized in style, yet written in C.
18  * We use classes, virtual functions, class members, and "this" pointers
19  * written in C.
20  */
21 
22 #ifndef WAVE_PRINT_H
23 #define WAVE_PRINT_H
24 
25 /*************************************************************************
26  * Print Context                                                         *
27  *                                                                       *
28  * This structure contains everything needed for the generic print code  *
29  *************************************************************************/
30 struct _gtk_print_device;
31 struct _pr_context {
32     struct _gtk_print_device *gpd; /* Pointer to print device class */
33     FILE *handle; /* Pointer to output file */
34     gdouble PageX; /* Legal page width */
35     gdouble PageY; /* Legal page height */
36     gdouble LM; /* Left Margin (inch) */
37     gdouble RM; /* Right Margin (inch) */
38     gdouble BM; /* Bottom Margin (inch) */
39     gdouble TM; /* Top Margin (inch) */
40     gdouble xscale, yscale, xtotal;
41     gdouble tr_x, tr_y;
42     gdouble gray;
43     int MinX, MinY, MaxX, MaxY;  /* These will be initialized by a routine */
44     char fullpage;
45 };
46 typedef struct _pr_context pr_context;
47 
48 /*************************************************************************
49  * GTKWave Print Device                                                  *
50  *                                                                       *
51  * This structure contains pointers to device specific operations        *
52  *************************************************************************/
53 struct _gtk_print_device {
54     void (*gpd_header)(pr_context *prc);
55     void (*gpd_trailer)(pr_context *prc);
56     void (*gpd_signal_init)(pr_context *prc);
57     void (*gpd_setgray)(pr_context *prc, gdouble gray);
58     void (*gpd_draw_line)(pr_context *prc, gdouble x1, gdouble y1, gdouble x2, gdouble y2);
59     void (*gpd_draw_box)(pr_context *prc, gdouble x1, gdouble y1, gdouble x2, gdouble y2);
60     void (*gpd_draw_string)(pr_context *prc, int x, int y, char *str, int xsize, int ysize);
61 };
62 typedef struct _gtk_print_device gtk_print_device;
63 
64 
65 void print_image(pr_context *prc);
66 void print_mif_image(FILE *wave, gdouble px, gdouble py);
67 void print_ps_image(FILE *wave, gdouble px, gdouble py);
68 
69 void ps_header(pr_context * prc);
70 void ps_trailer(pr_context * prc);
71 void ps_signal_init(pr_context * prc);
72 void ps_setgray(pr_context * prc, gdouble gray);
73 void ps_draw_line(pr_context * prc, gdouble x1, gdouble y1,
74 	     gdouble x2, gdouble y2);
75 void ps_draw_box(pr_context * prc, gdouble x1, gdouble y1, gdouble x2,
76 	    gdouble y2);
77 void ps_draw_string(pr_context * prc, int x, int y, char *str,
78 	       int xsize, int ysize);
79 
80 void mif_header(pr_context * prc);
81 void mif_trailer(pr_context * prc);
82 void mif_signal_init(pr_context * prc);
83 void mif_setgray(pr_context * prc, gdouble gray);
84 void mif_translate(pr_context * prc, gdouble x, gdouble y);
85 void mif_draw_line(pr_context * prc, gdouble x1, gdouble y1,
86 	      gdouble x2, gdouble y2);
87 void mif_draw_box(pr_context * prc, gdouble x1, gdouble y1,
88 	     gdouble x2, gdouble y2);
89 void mif_draw_string(pr_context * prc, int x, int y, char *str,
90 		int xsize, int ysize);
91 #endif
92 
93