home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / prnt3.zip / AppDefs.H < prev    next >
C/C++ Source or Header  |  1995-05-09  |  10KB  |  252 lines

  1.  
  2. /* appdefs.h        Created:    1995-02-09  Revised:   1995-04-02    */
  3.  
  4. /* Module Definition Header                        */
  5.  
  6. /************************************************************************/
  7. /************************************************************************/
  8. /************************************************************************/
  9. /* DISCLAIMER OF WARRANTIES:                        */
  10. /* -------------------------                        */
  11. /* The following [enclosed] code is sample code    created    by IBM        */
  12. /* Corporation and Prominare Inc.  This    sample code is not part    of any    */
  13. /* standard IBM    product    and is provided    to you solely for the purpose    */
  14. /* of assisting    you in the development of your applications.  The code    */
  15. /* is provided "AS IS",    without    warranty of any    kind.  Neither IBM nor    */
  16. /* Prominare shall be liable for any damages arising out of your    */
  17. /* use of the sample code, even    if they    have been advised of the    */
  18. /* possibility of such damages.                        */
  19. /************************************************************************/
  20. /************************************************************************/
  21. /************************************************************************/
  22. /*               D I S C L A I M E R                */
  23. /* This    code is    provided on an as is basis with    no implied support.    */
  24. /* It should be    considered freeware that cannot    be rebundled as        */
  25. /* part    of a larger "*ware" offering without our consent.        */
  26. /************************************************************************/
  27. /************************************************************************/
  28. /************************************************************************/
  29.  
  30. /* Copyright ╕ International Business Machines Corp., 1995.        */
  31. /* Copyright ╕ 1995  Prominare Inc.  All Rights    Reserved.        */
  32.  
  33.  
  34.  
  35. /************************************************************************/
  36. /************************************************************************/
  37. /*    Structure Definitions                        */
  38. /************************************************************************/
  39. /************************************************************************/
  40.  
  41.  
  42. typedef    struct _QUEINFO
  43.    {
  44.    PSZ           pszName;           /* Device Name            */
  45.    PSZ           pszDriverName;       /* Driver Name            */
  46.    PSZ           pszPrinters;       /* Printers                */
  47.    PVOID       pDriverData;       /* Device Data            */
  48.    } QUEINFO ;           /* quei */
  49.  
  50. typedef    QUEINFO    *PQUEINFO; /* pquei */
  51.  
  52. typedef    struct _PRN
  53.    {
  54.    HAB        hAB;           /* Anchor block for list        */
  55.    CHAR        szQueue[256];       /* Default Queue            */
  56.    INT        iQueue;           /* Selected Printer Index        */
  57.    INT        cQueues;       /* Total Queue Count            */
  58.    PQUEINFO    pquei;           /* Queue Information            */
  59.    } PRN ;           /* prn */
  60.  
  61. typedef    PRN *PPRN;       /* pprn */
  62.  
  63. /* --- Page Setup Structure Definitions    -------------------------------    */
  64.  
  65. typedef    struct _PAGESETUP           /* pags */
  66.    {
  67.    double rdLeftMargin;               /* Left Margin            */
  68.    double rdRightMargin;           /* Right    Margin            */
  69.    double rdTopMargin;               /* Top Margin            */
  70.    double rdBottomMargin;           /* Bottom Margin            */
  71.    CHAR      szHeader[256];           /* Header            */
  72.    CHAR      szFooter[256];           /* Footer            */
  73.    } PAGESETUP ;
  74.  
  75. typedef    PAGESETUP *PPAGESETUP;
  76.  
  77. /* --- Font Selection Structure    Definitions ---------------------------    */
  78.  
  79. typedef    struct _FONTSEL               /* fsel */
  80.    {
  81.    LONG      lMatch;               /* Font Match Number        */
  82.    BOOL      fFixed;               /* Fixed    Size Flag        */
  83.    LONG      lPointSize;               /* Font Point Size        */
  84.    LONG      lNominalPointSize;           /* Nominal Font Point Size    */
  85.    CHAR      szFacename[32];           /* Font Face Name        */
  86.    } FONTSEL ;
  87.  
  88. typedef    FONTSEL    *PFONTSEL;
  89.  
  90. typedef    struct _FONTSIZE           /* fsiz */
  91.    {
  92.    PSZ      pszSize;               /* Font Match Number        */
  93.    LONG      lPointSize;               /* Font Point Size        */
  94.    } FONTSIZE ;
  95.  
  96. #define    TWIPS_POINT    20L
  97.  
  98. typedef    struct _LOGFONT               /* lfont    */
  99.    {
  100.    LONG      lcid;                   /* Logical Font ID        */
  101.    LONG      alWidths[256];           /* Width    Table            */
  102.    BOOL      fScalable;               /* Scalable Font            */
  103.    SIZEF  sizfxBox;               /* Scalable Character Box    */
  104.    } LOGFONT ;
  105.  
  106. typedef    struct _FONTCACHE           /* fcache */
  107.    {
  108.    LOGFONT lfontNormal;               /* Normal Font            */
  109.    LOGFONT lfontBold;               /* Bold Font            */
  110.    LOGFONT lfontItalic;               /* Italic Font            */
  111.    } FONTCACHE ;
  112.  
  113. typedef    FONTCACHE *PFONTCACHE;
  114.  
  115. /* --- Re-entrant Printer Support -------------------------------------    */
  116.  
  117. typedef    struct _PRNDATA
  118.    {
  119.    PRN         prn;               /* Printer Information        */
  120.    FONTSEL   fsel;               /* Font Selection        */
  121.    PAGESETUP pags;               /* Page Setup            */
  122.    LONG         cPrnFiles;               /* Files    Count            */
  123.    BOOL         fLineNumbers;           /* Include Line Numbers Flag    */
  124.    BOOL         fDateFooter;           /* Date and Time    Footer Flag    */
  125.    CHAR         szTitle[CCHMAXPATH];      /* Print    Title            */
  126.    CHAR         aszFiles[1][CCHMAXPATH];  /* Files    Array Start        */
  127.    } PRNDATA ;           /* prni */
  128.  
  129. #define    PRNDATASIZE (sizeof(PRNDATA) - CCHMAXPATH)
  130.  
  131. typedef    PRNDATA    *PPRNDATA;
  132.  
  133. #define    TAB 9               /* Tab Stop Value            */
  134. #define    LF 10               /* Line Feed    Value            */
  135. #define    CR 13               /* Carriage Return Value        */
  136. #define    TOF 12               /* Top of Form Value            */
  137. #define    EOF_MARK 26           /* End of File Mark Value        */
  138. #define    ESCAPE 27           /* Escape Value            */
  139. #define    TOP_MARGIN 4           /* Printout Top Margin Count        */
  140.  
  141. #define    RGBCLR_PALEGRAY        0x00c9c9c9L
  142.  
  143. #define    RGBCLR_SHADOW        0x00808080L
  144. #define    RGBCLR_DIALOGBACKGROUND    0x00ccccccL
  145.  
  146. /************************************************************************/
  147. /************************************************************************/
  148. /*    Global Variable    Definitions                    */
  149. /************************************************************************/
  150. /************************************************************************/
  151.  
  152. extern FONTMETRICS fm;           /* Font Metrics Info            */
  153. extern HSWITCH       hSwitch;       /* Task List    Entry Handle        */
  154. extern HAB       hAB;           /* Program Anchor Block Handle    */
  155.  
  156. extern HPOINTER       hptrWait;       /* Wait Mouse Pointer Handle        */
  157. extern HPOINTER       hptrArrow;       /* Arrow Mouse Pointer Handle    */
  158.  
  159. extern HMQ  hmqPrnSetup;       /* Program Message Queue Handle    */
  160. extern HWND hwndPrnSetup;       /* Client Window Handle        */
  161. extern HWND hwndPrnSetupFrame;       /* Frame Window Handle        */
  162. extern HWND hmenuPrnSetup;       /* Menu Handle            */
  163.  
  164. extern HPS hpsPrint;           /* Print Window Presentation    Handle    */
  165.  
  166. extern HWND hwndToolBar;       /* Client Window Handle        */
  167. extern HWND hwndToolBarFrame;       /* Frame Window Handle        */
  168.  
  169. extern HWND hwndHelp;           /* Help Window Handle        */
  170. extern HELPINIT    helpinit;       /* Help Initialization Table        */
  171.  
  172. extern PRN  prn;           /* Printer Control Holder        */
  173.  
  174. extern FONTSEL        fsel;       /* Font Selection            */
  175.  
  176. extern PAGESETUP pags;           /* Page Setup            */
  177.  
  178. extern FONTCACHE fcache;       /* Font Cache            */
  179. extern FONTCACHE fcacheScale;       /* Scale Font Cache            */
  180.  
  181. /************************************************************************/
  182. /************************************************************************/
  183. /*    Function Prototype Definitions                    */
  184. /************************************************************************/
  185. /************************************************************************/
  186.  
  187. /* --- Fonts.C Prototype Definitions ----------------------------------    */
  188.  
  189. LONG lSetFonts(HWND hwndFontNames);
  190. VOID SetFontSize(HWND hwndFont,    HWND hwndFontSize);
  191. BOOL fQuerySelectedFont(HWND hwndFont, HWND hwndFontSize, PFONTSEL pfsel);
  192. LONG lSelectFont(HPS hPS, HDC hDC, PSZ pszFacename, LONG lNominalPointSize,
  193.          ULONG fl, PBOOL pfScalable, PSIZEF psizfxBox);
  194. VOID DeSelectFont(HPS hPS, LONG    lcid);
  195. VOID BuildFontCache(HPS    hpsTarget, HPS hpsPrinter, HDC hdcPrinter,
  196.             PSZ    pszFacename, LONG lNominalPointSize,
  197.             PFONTCACHE pfcache);
  198. VOID DeleteFontCache(HPS hpsTarget, PFONTCACHE pfcache);
  199.  
  200. /* --- PrnAPI.C    Prototype Definitions ---------------------------------    */
  201.  
  202. BOOL    PrnCreatePrinterList(PPRN pprn);
  203. BOOL    PrnDestroyPrinterList(PPRN pprn);
  204. HDC    PrnOpenDC(PPRN pprn, PSZ pszDataType);
  205. HDC    PrnOpenInfoDC(PPRN pprn, PSZ pszDataType);
  206. BOOL    PrnQueryJobProperties(PPRN pprn, INT iQueue);
  207. PSZ    PrnQueryPrinterName(PPRN pprn);
  208.  
  209. MRESULT    EXPENTRY PrnSetupDlgProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  210. MRESULT    EXPENTRY FilePrintDlgProc(HWND hWnd, ULONG msg,    MPARAM mp1, MPARAM mp2);
  211.  
  212. LONG SelectFont(HDC hDC, HPS hPS, CHAR *pszFacename,
  213.         LONG lPoints);
  214. LONG SelectScalableFont(HPS hPS, CHAR *pszFacename);
  215. LONG ScaleFont(HPS hPS,    CHAR *pszFacename, LONG    lSize);
  216.  
  217. /* --- DrawPage.C Prototype Definitions    -------------------------------    */
  218.  
  219. VOID DrawCommon(HPS hPS, HPS hpsPrinter, PFONTCACHE pfcache,
  220.         LONG lLeftMargin, LONG lBottomMargin,
  221.         LONG lRightMargin, LONG    lTopMargin,
  222.         PSZ pszHeader, PSZ pszFooter, BOOL fDrawHeader);
  223. VOID DrawText(HPS hpsTarget);
  224. VOID _System PrnDisplay(PPRNDATA pprni);
  225.  
  226. /* --- PageDlg.C Prototype Definitions --------------------------------    */
  227.  
  228. MRESULT    EXPENTRY PageSetupDlgProc(HWND hWnd, ULONG msg,    MPARAM mp1, MPARAM mp2);
  229.  
  230. /* --- PrnWnd.C    Prototype Definitions ---------------------------------    */
  231.  
  232. MRESULT    EXPENTRY PrintDriverWndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  233.  
  234. /* --- PrevDlg.C Prototype Definitions --------------------------------    */
  235.  
  236. HBITMAP    hbmCreatePreview(LONG cx, LONG cy, HPS hpsPrinter, HDC hdcPrinter);
  237. MRESULT    EXPENTRY PrintPreviewDlgProc(HWND hWnd,    ULONG msg, MPARAM mp1, MPARAM mp2);
  238.  
  239. /* --- Support.C Prototype Definitions --------------------------------    */
  240.  
  241. VOID    InitApp(HWND hwndFrame,    HWND hwndClient, PSZ pszWindowListTitle);
  242. HWND    CreateStdWindow(HWND hwndParent, ULONG flStyle,    ULONG flCreateFlags,
  243.             PSZ pszClientClass, PSZ    pszTitle, ULONG    styleClient,
  244.             HMODULE    hmod, ULONG idResources, PHWND phwndClient,
  245.             LONG x,    LONG y,    LONG cx, LONG cy);
  246. MRESULT    PDSKeyProc(HWND    hWnd, ULONG msg, MPARAM    mp1, MPARAM mp2);
  247. VOID    PDSGetTemplate(HWND hWnd, ULONG    id);
  248.  
  249. /* --- ToolBar.C Prototype Definitions --------------------------------- */
  250.  
  251. MRESULT    EXPENTRY ToolBarWndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  252.