home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / pstoedit.zip / source.zip / pstoedit.2.50 / src / drvmet.h < prev    next >
C/C++ Source or Header  |  1996-10-04  |  4KB  |  157 lines

  1. #ifndef __drvMET_h
  2. #define __drvMET_h
  3. /*
  4.    drvMET.c : This file is part of pstoedit
  5.    Backend for OS/2 Meta Files.
  6.    Contributed by : Christoph Jaeschke (jaeschke@imbe05.imbe.uni-bremen.de)
  7.  
  8.    Copyright (C) 1993,1994,1995,1996 Wolfgang Glunz, Wolfgang.Glunz@zfe.siemens.de
  9.  
  10.     This program is free software; you can redistribute it and/or modify
  11.     it under the terms of the GNU General Public License as published by
  12.     the Free Software Foundation; either version 2 of the License, or
  13.     (at your option) any later version.
  14.  
  15.     This program is distributed in the hope that it will be useful,
  16.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  17.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  18.     GNU General Public License for more details.
  19.  
  20.     You should have received a copy of the GNU General Public License
  21.     along with this program; if not, write to the Free Software
  22.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  23.  
  24. */
  25.  
  26. #define INCL_WIN
  27. #define INCL_DOSMEMMGR
  28. #define INCL_WINDIALOGS
  29. #define INCL_DOS
  30. #define INCL_DEV
  31. #define INCL_GPILCIDS           // Fonts
  32. #define INCL_GPILOGCOLORTABLE
  33. #define INCL_GPIPRIMITIVES
  34. #define INCL_GPIPATHS
  35. #define INCL_GPIPOLYGON
  36. #define INCL_GPIMETAFILES
  37. #include <os2.h>
  38.  
  39. #include "drvbase.h"
  40.  
  41. class INTFONTMAP; // Just a simple forward
  42.  
  43. #define maxMapEntries 255
  44. #define MSGBOXID    1001
  45. #define ID_WINDOW   256
  46. #define ID_COMMAND1  257
  47.  
  48. #ifndef __GNUG__
  49. extern "OPTLINK" {
  50. #endif
  51. void OS2WIN_WM_COMMAND_THREAD(void *);
  52. #ifndef __GNUG__
  53. }
  54. #endif
  55.  
  56. // GNU OS/2 headers looks like a bit different, so...
  57.  
  58. #ifdef __GNUG__
  59. #define PXCHAR unsigned char*
  60. #define PCXCHAR unsigned char*
  61. #else
  62. #define PXCHAR char*
  63. #define PCXCHAR const char*
  64. #endif
  65.  
  66. MRESULT EXPENTRY PS2MET_WinProc( HWND, ULONG, MPARAM, MPARAM);
  67.  
  68. class OS2WIN {
  69. public:
  70.     OS2WIN();
  71.     ~OS2WIN();
  72.     void run();
  73.     void abort(HWND, HWND);
  74. };
  75.  
  76. struct DRVMETSETUP {
  77.     long exit;
  78.     long info;
  79.     long draw_noPath;
  80.     long draw_noColor;
  81.     long draw_target;
  82.     enum targetType {to_META, to_WINDOW};
  83.     long draw_noFill;
  84.     long draw_noText;
  85.     long draw_noGraphic;
  86.     char *pMetaFileName;
  87.     DRVMETSETUP(char*);
  88. };
  89.  
  90. extern DRVMETSETUP *pDrvMETsetup;
  91. extern int yylex(drvbase*);
  92.  
  93. class drvMET : public drvbase {
  94.  
  95. private:
  96.     HPS hps;
  97.     HDC hdc;
  98.     HPAL hpal;
  99.     PFONTMETRICS    pfm;
  100.     PFATTRS    pfat;
  101.     long cntFonts;
  102.     long showFontList;
  103.     char lastSelectedFontName[maxFontNamesLength];
  104.     long cntPalEntries;
  105.     ULONG *alTable;
  106.     INTFONTMAP *pIntFontmap;
  107.     long maxPalEntries;
  108.     long palStart;
  109.     long get_print_coords(PPOINTL);
  110.     void drawPoly(int, PPOINTL, int);
  111.  
  112. public:
  113.     drvMET(const char * driveroptions_P,ostream & theoutStream,ostream & theerrStream );
  114.     ~drvMET();
  115.  
  116.     long palEntry(float, float, float);
  117.     long searchPalEntry(long);
  118.     void setColor(float, float, float);
  119.     int FetchFont (SHORT idFont, PCHAR pFontName, long selection, PFATTRS *pfat);
  120.  
  121.     inline int transX(float k) { return (int)((k + x_offset)*scale);};
  122.     inline int transY(float k) { return (int)((k + y_offset)*scale);};
  123.  
  124. #include "drvfuncs.h"
  125.  
  126. };
  127.  
  128. class FONTMAPENTRY {
  129.     char gsName[maxFontNamesLength];
  130.     char pmName[maxFontNamesLength];
  131.  
  132. public:
  133.     FONTMAPENTRY(char* , char* );
  134.     ~FONTMAPENTRY() {};
  135.     inline char* getpmName() {return pmName;};
  136.     inline char* getgsName() {return gsName;};
  137.     inline void reAllocpmName(char* initName) {strcpy(pmName,initName);};
  138.     inline void reAllocgsName(char* initName) {strcpy(gsName,initName);};
  139.     // void reAllocgsName(char*);
  140. };
  141.  
  142. class INTFONTMAP {
  143.     FONTMAPENTRY *mapEntry[maxMapEntries];
  144.     long cntMapEntries;
  145.     char* fontmapFile;
  146.     char* scanEnv(char*, char*);
  147.     void readFontmap();
  148.     void addEntry(char *pLine);
  149.     ostream *pOutf;
  150. public:
  151.     INTFONTMAP(ostream*);
  152.     ~INTFONTMAP();
  153.     char* searchMapEntry(char*);
  154. };
  155.  
  156. #endif
  157.