home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dbcs.zip / APPDEFS.H < prev    next >
C/C++ Source or Header  |  1996-01-21  |  11KB  |  261 lines

  1.  
  2. /* appdefs.h        Created:    1996-01-19  Revised:   1996-01-19    */
  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., 1996.        */
  31. /* Copyright ╕ 1996  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. /* --- DBCS.C Prototype    Definitions -----------------------------------    */
  188.  
  189. VOID SetCountryCode(ULONG ulCountry, ULONG ulCP);
  190. BOOL fQueryDBCS(VOID);
  191. PSZ  strrchrDBCS(const CHAR *p,    INT c);
  192. PSZ  strchrDBCS(const CHAR *p, INT c);
  193. PSZ  struprDBCS(CHAR *p);
  194. PSZ  strstrDBCS(const CHAR *str1, const    CHAR *str2);
  195. VOID SetDBCSFont(HWND hWnd);
  196.  
  197. /* --- Fonts.C Prototype Definitions ----------------------------------    */
  198.  
  199. LONG lSetFonts(HWND hwndFontNames);
  200. VOID SetFontSize(HWND hwndFont,    HWND hwndFontSize);
  201. BOOL fQuerySelectedFont(HWND hwndFont, HWND hwndFontSize, PFONTSEL pfsel);
  202. LONG lSelectFont(HPS hPS, HDC hDC, PSZ pszFacename, LONG lNominalPointSize, ULONG fl, PBOOL pfScalable,    PSIZEF psizfxBox);
  203. VOID DeSelectFont(HPS hPS, LONG    lcid);
  204. VOID BuildFontCache(HPS    hpsTarget, HPS hpsPrinter, HDC hdcPrinter, PSZ pszFacename, LONG lNominalPointSize,
  205.             PFONTCACHE pfcache);
  206. VOID DeleteFontCache(HPS hpsTarget, PFONTCACHE pfcache);
  207.  
  208. /* --- PrnAPI.C    Prototype Definitions ---------------------------------    */
  209.  
  210. BOOL    PrnCreatePrinterList(PPRN pprn);
  211. BOOL    PrnDestroyPrinterList(PPRN pprn);
  212. HDC    PrnOpenDC(PPRN pprn, PSZ pszDataType);
  213. HDC    PrnOpenInfoDC(PPRN pprn, PSZ pszDataType);
  214. BOOL    PrnQueryJobProperties(PPRN pprn, INT iQueue);
  215. PSZ    PrnQueryPrinterName(PPRN pprn);
  216.  
  217. MRESULT    EXPENTRY PrnSetupDlgProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  218. MRESULT    EXPENTRY FilePrintDlgProc(HWND hWnd, ULONG msg,    MPARAM mp1, MPARAM mp2);
  219.  
  220. LONG SelectFont(HDC hDC, HPS hPS, CHAR *pszFacename, LONG lPoints);
  221. LONG SelectScalableFont(HPS hPS, CHAR *pszFacename);
  222. LONG ScaleFont(HPS hPS,    CHAR *pszFacename, LONG    lSize);
  223.  
  224. /* --- DrawPage.C Prototype Definitions    -------------------------------    */
  225.  
  226. VOID DrawCommon(HPS hPS, HPS hpsPrinter, PFONTCACHE pfcache,
  227.         LONG lLeftMargin, LONG lBottomMargin,
  228.         LONG lRightMargin, LONG    lTopMargin,
  229.         PSZ pszHeader, PSZ pszFooter, BOOL fDrawHeader);
  230. VOID DrawText(HPS hpsTarget);
  231. VOID _System PrnDisplay(PPRNDATA pprni);
  232.  
  233. /* --- PageDlg.C Prototype Definitions --------------------------------    */
  234.  
  235. MRESULT    EXPENTRY PageSetupDlgProc(HWND hWnd, ULONG msg,    MPARAM mp1, MPARAM mp2);
  236.  
  237. /* --- PrnWnd.C    Prototype Definitions ---------------------------------    */
  238.  
  239. MRESULT    EXPENTRY PrintDriverWndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  240.  
  241. /* --- PrevDlg.C Prototype Definitions --------------------------------    */
  242.  
  243. HBITMAP    hbmCreatePreview(LONG cx, LONG cy, HPS hpsPrinter, HDC hdcPrinter);
  244. MRESULT    EXPENTRY PrintPreviewDlgProc(HWND hWnd,    ULONG msg, MPARAM mp1, MPARAM mp2);
  245.  
  246. /* --- Support.C Prototype Definitions --------------------------------    */
  247.  
  248. VOID    InitApp(HWND hwndFrame,    HWND hwndClient, PSZ pszWindowListTitle);
  249. HWND    CreateStdWindow(HWND hwndParent, ULONG flStyle,    ULONG flCreateFlags,
  250.             PSZ pszClientClass, PSZ    pszTitle, ULONG    styleClient,
  251.             HMODULE    hmod, ULONG idResources, PHWND phwndClient,
  252.             LONG x,    LONG y,    LONG cx, LONG cy);
  253. MRESULT    PDSKeyProc(HWND    hWnd, ULONG msg, MPARAM    mp1, MPARAM mp2);
  254. VOID    PDSGetTemplate(HWND hWnd, ULONG    id);
  255. VOID    CenterDlg(HWND hWnd);
  256.  
  257. /* --- ToolBar.C Prototype Definitions --------------------------------- */
  258.  
  259. MRESULT    EXPENTRY ToolBarWndProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  260. MRESULT    EXPENTRY FontMetricsDlgProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2);
  261.