| 1 |
/* |
| 2 |
* Copyright (c) 2002-2004 Paul Vojta and the xdvik development team |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
| 5 |
* of this software and associated documentation files (the "Software"), to |
| 6 |
* deal in the Software without restriction, including without limitation the |
| 7 |
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
| 8 |
* sell copies of the Software, and to permit persons to whom the Software is |
| 9 |
* furnished to do so, subject to the following conditions: |
| 10 |
* |
| 11 |
* The above copyright notice and this permission notice shall be included in |
| 12 |
* all copies or substantial portions of the Software. |
| 13 |
* |
| 14 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 15 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 16 |
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 17 |
* NONINFRINGEMENT. IN NO EVENT SHALL ANY AUTHO OF THIS SOFTWARE BE |
| 18 |
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 19 |
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 20 |
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 21 |
* SOFTWARE. |
| 22 |
*/ |
| 23 |
|
| 24 |
#ifndef PRINT_INTERNAL_H_ |
| 25 |
#define PRINT_INTERNAL_H_ |
| 26 |
|
| 27 |
#include "dvi-init.h" |
| 28 |
|
| 29 |
typedef enum { FMT_PS, FMT_PS2PDF, FMT_DVI, FMT_ISO_8859_1, FMT_UTF8, FMT_NONE } outputFormatT; |
| 30 |
|
| 31 |
/* collection of all file IOs used in printing/saving */ |
| 32 |
struct file_info { |
| 33 |
char *tmp_dvi_file; /* temporary DVI file */ |
| 34 |
FILE *tmp_dvi_fp; /* FILE * for temporary DVI file */ |
| 35 |
char *tmp_ps_file; /* temporary PS file */ |
| 36 |
char *out_file; /* final output file */ |
| 37 |
/* FILE *out_fp; */ /* FILE * for final output file */ |
| 38 |
FILE *in_fp; /* FILE * for input file */ |
| 39 |
}; |
| 40 |
|
| 41 |
/* stacks for communication with selection routines */ |
| 42 |
struct specials_stack_elem { |
| 43 |
char *content; /* string content */ |
| 44 |
}; |
| 45 |
|
| 46 |
struct specials_stack { |
| 47 |
size_t stack_len; |
| 48 |
struct specials_stack_elem *items; |
| 49 |
}; |
| 50 |
|
| 51 |
typedef enum printRadioT_ { |
| 52 |
NO_PRINT_VAL = -1, |
| 53 |
TO_PRINTER = 1, |
| 54 |
TO_FILE |
| 55 |
} printRadioT; |
| 56 |
|
| 57 |
|
| 58 |
typedef enum pageRadioT_ { |
| 59 |
NO_PAGE_VAL = -1, |
| 60 |
PAGE_ALL = 1, |
| 61 |
PAGE_MARKED, |
| 62 |
PAGE_RANGE |
| 63 |
} pageRadioT; |
| 64 |
|
| 65 |
struct save_or_print_info; /* forward declaration */ |
| 66 |
|
| 67 |
/* wrapper struct which stores information about values the user has |
| 68 |
selected in the dialog. |
| 69 |
*/ |
| 70 |
struct select_pages_info { |
| 71 |
int from; /* lower bound of page range to be selected */ |
| 72 |
int to; /* upper bound of page range to be selected */ |
| 73 |
/* struct file_info *finfo; \/\* additional file info pointer \*\/ */ |
| 74 |
/* callback function that says whether a page should be selected or not; |
| 75 |
will be passed a pointer to the current struct save_or_print_info, |
| 76 |
and the current page */ |
| 77 |
Boolean (*callback)(struct save_or_print_info *info, int page); |
| 78 |
struct specials_stack warn_files; /* collect warnings about included files */ |
| 79 |
dviErrFlagT errflag; /* collect all kinds of errors that can happen while copying */ |
| 80 |
}; |
| 81 |
|
| 82 |
typedef enum { FILE_PRINT = 0, FILE_SAVE = 1 } printOrSaveActionT; |
| 83 |
|
| 84 |
|
| 85 |
struct callback_info { |
| 86 |
XtCallbackProc cb_close; |
| 87 |
XtCallbackProc cb_cancel; |
| 88 |
XtCallbackProc cb_destroy; |
| 89 |
XtCallbackProc cb_keep; |
| 90 |
}; |
| 91 |
|
| 92 |
struct save_or_print_info { |
| 93 |
printOrSaveActionT act; /* whether we're printing or saving */ |
| 94 |
outputFormatT fmt; /* DVI/PS/... */ |
| 95 |
printRadioT print_target; /* to printer or to file */ |
| 96 |
pageRadioT page_selection; /* which pages: all/marked/range */ |
| 97 |
char *printer_options; /* printer name + options from text field */ |
| 98 |
char *dvips_options; /* dvips options from text field */ |
| 99 |
Widget shell; |
| 100 |
Widget message_popup; |
| 101 |
Widget printlog; |
| 102 |
struct select_pages_info *pinfo; |
| 103 |
struct callback_info *callbacks; |
| 104 |
struct file_info *finfo; |
| 105 |
}; |
| 106 |
|
| 107 |
extern void internal_print(struct save_or_print_info *info); |
| 108 |
extern void internal_save(struct save_or_print_info *info); |
| 109 |
|
| 110 |
#endif /* PRINT_INTERNAL_H_ */ |
| 111 |
|