home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Amiga 14 / MA_Cover_14.iso / source / c / pegase_src / display.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-08-14  |  3.4 KB  |  140 lines

  1. #ifndef CLASS_DISPLAY_HPP
  2. #define CLASS_DISPLAY_HPP
  3.  
  4. /*
  5. **
  6. ** Display.hpp
  7. **
  8. ** (c) 1999 Didier Levet
  9. **
  10. ** Fonctions d'affichage
  11. **
  12. **
  13. */
  14.  
  15. #ifndef  _INCLUDE_IOSTREAM_H
  16. #include <fstream.h>
  17. #endif
  18.  
  19. #ifndef  CLIB_LOCALE_PROTOS_H
  20. #include <clib/locale_protos.h>
  21. #endif
  22.  
  23. #ifndef  CLIB_DOS_PROTOS_H
  24. #include <clib/dos_protos.h>
  25. #endif
  26.  
  27.  
  28. #ifndef STRING
  29. typedef const char *STRING;
  30. #endif
  31.  
  32.  
  33. STRING GetString(long iStringID);
  34.  
  35.  
  36. //----------------------------------------------------------------------------------------------------
  37. //======================================== class LocalStrings ========================================
  38. //----------------------------------------------------------------------------------------------------
  39.  
  40. class LocalStrings
  41. {
  42.     public:
  43.  
  44.         LocalStrings();
  45.         ~LocalStrings();
  46.  
  47.         STRING read(long stringID, char *defString)
  48.         {
  49.             if (pCatalog) return (::GetCatalogStr(pCatalog, stringID, defString));
  50.             else          return (defString);
  51.         }
  52.  
  53.     private:
  54.  
  55.         struct Locale  *pLocaleBase;
  56.         struct Catalog *pCatalog;
  57. };
  58.  
  59.  
  60. //----------------------------------------------------------------------------------------------------
  61. //========================================== class Display ===========================================
  62. //----------------------------------------------------------------------------------------------------
  63. //
  64. // La classe "Display" est une classe virtuelle. Elle sert de base (ou de HAL) en proposant toutes les
  65. // fonctions d'affichage, que le fonctionnement de Pegase se fasse en mode CLI ou en mode WB.
  66.  
  67. class PegaseConfigC;
  68. class FileInfosC;
  69. class EncoderConfigC;
  70.  
  71.  
  72. class Display
  73. {
  74.     public:
  75.  
  76.         Display() : bFromWB(FALSE), bDisableAnim(FALSE) {}
  77.         virtual ~Display() {}
  78.  
  79.         void PrintErrorMsg(STRING msg);
  80.         void PrintDOSError(int errCode);
  81.         void DisplayBanner();
  82.         void ShowConfig(const PegaseConfigC& rCfg);
  83.         void ShowEncodingInfos(const EncoderConfigC *pConfig);
  84.         void ShowCurrentJob(const FileInfosC *fi);
  85.  
  86.         int  UpdateProgression(ULONG val, FileInfosC *fi);
  87.         void ResetAnimVal() {mAnimVal = mDotsDelay = 0;}
  88.  
  89.         virtual operator ostream& () = 0;
  90.         virtual ostream& out() = 0;
  91.  
  92.     protected:
  93.  
  94.         int   bFromWB;              // TRUE si démarrage en mode WorkBench.
  95.         int   bDisableAnim;
  96.         ULONG mAnimVal;
  97.         ULONG mDotsDelay;
  98. };
  99.  
  100. extern Display *display;
  101.  
  102.  
  103. //----------------------------------------------------------------------------------------------------
  104. //========================================= class CLIDisplay =========================================
  105. //----------------------------------------------------------------------------------------------------
  106.  
  107. class CLIDisplay : public Display
  108. {
  109.     public:
  110.  
  111.         CLIDisplay();
  112.  
  113.         operator ostream& () { return cout; }
  114.         ostream& out()       { return cout; }
  115. };
  116.  
  117.  
  118. //----------------------------------------------------------------------------------------------------
  119. //========================================= class WBDisplay ==========================================
  120. //----------------------------------------------------------------------------------------------------
  121.  
  122. class WBDisplay : public Display
  123. {
  124.     public:
  125.  
  126.         WBDisplay();
  127.         ~WBDisplay();
  128.  
  129.         operator ostream& () { return *ostr; }
  130.         ostream& out()       { return *ostr; }
  131.  
  132.     protected:
  133.  
  134.         ofstream    *ostr;
  135. };
  136.  
  137.  
  138. #endif  // CLASS_DISPLAY_HPP
  139.  
  140.