home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 8 Other / 08-Other.zip / tplab009.zip / tapelab.h < prev    next >
C/C++ Source or Header  |  1996-05-05  |  6KB  |  263 lines

  1. /* 
  2.  
  3.  
  4.     tapelab.h (emx+gcc) 
  5.     Tape Label Editor Version 0.09
  6.  
  7.     1995 1996 Giovanni Iachello
  8.     This is freeware software. You can use or modify it as you wish,
  9.     provided that the part of code that I wrote remains freeware.
  10.     Freeware means that the source code must be available on request 
  11.     to anyone.
  12.     You must also include this notice in all files derived from this
  13.     file.
  14.  
  15.  
  16. */
  17. #ifndef _TAPELAB_H_
  18. #define _TAPELAB_H_
  19.  
  20. #define ID_TAPELAB 1
  21.  
  22. #define DID_HELP 9
  23.  
  24. #define IDM_COMP 10
  25. #define IDM_SIZE 11
  26. #define IDM_TITLE 12
  27. #define IDM_TEXT 13
  28. #define IDM_SAVE 16
  29. #define IDM_INFO 14
  30. #define IDM_FORM 15
  31.  
  32. #define IDM_FONTS 20
  33. #define IDM_FON_TIA 21
  34. #define IDM_FON_TIB 22
  35. #define IDM_FON_TXA 23
  36. #define IDM_FON_TXB 24
  37. #define IDM_FON_DATE 25
  38. #define IDM_FON_SOURCE 26
  39. #define IDM_FON_NR 27
  40.  
  41.  
  42. #define DLG_TITLE 1100
  43. #define DTITLE_EF_T1 1101
  44. #define DTITLE_EF_T2 1102
  45.  
  46. #define DLG_TEXT 1200
  47. #define DTEXT_MLE_T1 1201
  48. #define DTEXT_MLE_T2 1202
  49.  
  50. #define DLG_SIZE 1300
  51. #define DSIZE_SB_FLAPS 1301
  52. #define DSIZE_RB_NORMAL 1302
  53. #define DSIZE_RB_TDK 1303
  54. #define DSIZE_RB_SONY 1304
  55. #define DSIZE_RB_CUSTOM 1305
  56. #define DSIZE_EF_X 1306
  57. #define DSIZE_EF_Y 1307
  58. #define DSIZE_EF_WIDTH 1308
  59. #define DSIZE_EF_FLAP1 1309
  60. #define DSIZE_EF_FLAP2 1310
  61. #define DSIZE_EF_FLAP3 1311
  62. #define DSIZE_EF_FLAP4 1312
  63.  
  64. #define DLG_INFO 1400
  65. #define DINFO_EF_DATE1 1401
  66. #define DINFO_PB_CURRDATE1 1407
  67. #define DINFO_SB_NR1 1402
  68. #define DINFO_SB_SOURCE1 1403
  69. #define DINFO_EF_DATE2 1404
  70. #define DINFO_PB_CURRDATE2 1408
  71. #define DINFO_SB_NR2 1405
  72. #define DINFO_SB_SOURCE2 1406
  73. #define DINFO_CB_BASE0 1410   
  74. #define DINFO_CB_BASE1 1411
  75. #define DINFO_CB_BASE2 1412
  76. #define DINFO_CB_BASE3 1413
  77. #define DINFO_CB_BASE4 1414
  78. #define DINFO_CB_BASE5 1415
  79.  
  80. #define DLG_FORMAT 1600
  81. #define DFORM_EF_TABSIZE 1601
  82. #define DFORM_EF_TITLM 1602
  83. #define DFORM_EF_TTM 1603
  84. #define DFORM_EF_TLM 1604
  85. #define DFORM_EF_THSB 1605
  86. #define DFORM_EF_THSA 1606
  87. #define DFORM_EF_TVSA 1607
  88. #define DFORM_EF_TVSB 1608
  89.  
  90. #define SA_APPLNAME "TAPELAB"
  91. #define SA_SWPKEY "WINDOWPOS"
  92. #define SA_SETTINGSKEY "SETTINGS_V1"
  93.                       
  94. #include "tl_help.h"
  95.  
  96. #ifndef RC_INVOKED
  97.  
  98. #define INCL_WIN
  99. #include "pmwin.h"
  100. #include "pmdlg.h"
  101. #include "pmgpi.h"
  102.  
  103. struct _fontinfo         // full information for font management
  104. {
  105.     FATTRS fattrs;        // OS2 font structure
  106.     LONG height;        // .. and useful info about the font (sizes etc)
  107.     LONG extleading;
  108.     ULONG type;
  109.     SHORT point;
  110. };
  111.  
  112. struct _formatting {
  113.     int titlelm; // margine sin. titolo left title margin
  114.     int textlm,texttm; // margine sinistro e superiore testo, text left and top margins
  115.     int tabsize; // dimensione tabs, tab size;
  116.     int textvert1,textvert2;    // permillesimi di spaziatura orizzontale e verticale, thousands of vertical spaceing 
  117.     int texthoriz1,texthoriz2;    
  118. };
  119.  
  120. struct _customsize {    // custom label size 
  121.     int width;
  122.     int flap[4];
  123. };
  124.  
  125. // this structure contains all the information about the label. It is used
  126. // partly also by the save settings function.
  127. struct _labelformat 
  128. {
  129. // data members
  130.     int flaps; // numero di flaps 2, 3 o 4 (flaps number 2,3, or 4)
  131.     int size;  // size parameters 
  132.  
  133.     char* title1;
  134.     char* title2;
  135.     _fontinfo title1font;
  136.     _fontinfo title2font;
  137.  
  138.     char* text1;
  139.     char* text2;
  140.     _fontinfo text1font;
  141.     _fontinfo text2font;
  142.  
  143.     _formatting form;
  144.     
  145.     int whatinfo[6]; // sceglie quali info stampare
  146.     char* date1;
  147.     int source1;
  148.     int nr1;
  149.     char* date2;
  150.     int source2;
  151.     int nr2;
  152.     _fontinfo datefont;
  153.     _fontinfo sourcefont;
  154.     _fontinfo nrfont;
  155.  
  156.     _customsize customsize;
  157. // member functions    
  158.     _labelformat();
  159.     ~_labelformat();
  160.     BOOL save(const char* file); // save to file
  161.     BOOL load(const char* file); // load from file
  162.     void newformat(_labelformat* nf);  // read new format form init file
  163.     void writecustomfixpoints(); // write fixpoints structure with customsize data
  164. };
  165.  
  166.  
  167. extern POINTL fixpoints[4][10];
  168. extern char *apchSources[];
  169. extern char *apchNR[];
  170.  
  171. // application global information
  172.  
  173. extern PMApp* App;
  174.  
  175. extern PMHelpWin *helpwin;
  176.  
  177. #ifndef min
  178. #define min(a,b) ((a) < (b) ? (a) : (b))
  179. #endif
  180. #ifndef max
  181. #define max(a,b) ((a) > (b) ? (a) : (b))
  182. #endif
  183.  
  184. #define pts2dmm(x) ((x)*254L/72L)
  185.  
  186. class TapeLab : public PMMainWin {
  187.     char* tempfile;
  188.     _labelformat labelformat;
  189.     PMVertScrollBar* sb;
  190.     PMRect viewport;
  191.     LONG sizey,posy;
  192. public:
  193.     TapeLab(HAB ab,char* file);
  194.     ~TapeLab();
  195.     BOOL paint(PMPresSpace& ps);       // redefine processing of these messages.
  196.     BOOL paintlabel(PMPresSpace& ps);
  197.     BOOL size(SHORT cx,SHORT cy);
  198.     BOOL other(PMEvent &event);    
  199.     void saveApplication();         
  200.     BOOL create(PMEvent &event);
  201.  
  202.     BOOL command(USHORT id,USHORT cmddev);
  203.     BOOL setFont(_fontinfo *font,char* title);
  204.     BOOL paintString(char* str,_fontinfo *font,int spc,PMPoint pos,PMPresSpace &ps);
  205.     BOOL createWin(); 
  206.     
  207.     BOOL fileNew(); 
  208.     BOOL filePrint();
  209.     BOOL fileOpen(PCSZ filename); 
  210.     BOOL fileSave(PCSZ filename); 
  211.     LONG queryStrWidth(PSZ pszString,_fontinfo *font,PMPresSpace& ps);
  212.     BOOL helpmsg(PMEvent &event);
  213.     void restoreInitialFormat();
  214. };
  215.  
  216. BOOL helpHook ( HAB habAnchor, SHORT sMode, USHORT usTopic, USHORT usSubTopic, PRECTL prclPos );
  217.  
  218. ////////////////////////////////////////////////////////////////////////////
  219. // Information and Size dialogs
  220. //
  221. class InfoDlg : public PMModalDialog {
  222. public:
  223.     InfoDlg(HWND hwnd,PMControlMap* ctrlmap,void* data) : PMModalDialog(HWND_DESKTOP,hwnd,DLG_INFO,ctrlmap,data)
  224.         { }
  225.     BOOL command(USHORT id,USHORT cmddev);
  226.     BOOL initdlg();
  227. };
  228.  
  229. class SizeDlg : public PMModalDialog {
  230. public:
  231.     SizeDlg(HWND hwnd,PMControlMap* ctrlmap,void* data) : PMModalDialog(HWND_DESKTOP,hwnd,DLG_SIZE,ctrlmap,data)
  232.         { }
  233.     BOOL initdlg();
  234. };
  235.  
  236. //////////////////////////////////////////////////////////////////////////////
  237.  
  238. //
  239. // usa un thread separato per stampare l'output, in modo da non bloccare
  240. // il programma!
  241. // use a separate thread for printing, to avoid blocking the rest of the
  242. // program.
  243. //
  244.  
  245.  
  246. class PMPrintLabelThread : public PMWindowThread 
  247. {
  248.     TapeLab* tl;
  249.     char* buf;
  250. public:
  251.     PMPrintLabelThread(char* ibuf,TapeLab *itl) : PMWindowThread() 
  252.     {
  253.         buf=ibuf; tl=itl;
  254.     }
  255.     void main(void* arg=NULL) ;
  256. };
  257.  
  258. #endif     /* RC_INVOKED */
  259.  
  260. #endif     /* _TAPELAB_H_ */
  261.  
  262.  
  263.