home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c016 / 3.ddi / MEDIADIB.PAK / DIBDOC.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1993-12-07  |  1.5 KB  |  64 lines

  1. //---------------------------------------------------------
  2. //     DIBDOC - TDIBDocument source module
  3. //---------------------------------------------------------
  4. #include <owl\owlpch.h>
  5. #include "dibdoc.h"
  6.  
  7. ////////////////////////////////////////////////////////////////
  8. BOOL TDIBDocument::Open(int /*mode*/, LPCSTR path)
  9. {
  10.   if (!IsDirty()) {
  11.     hDIB = (HDIB)imkLoad(path ? (char*)path : (char*)GetDocPath(), IMK_EXTENSION, 0);
  12.     if (path)
  13.       SetDocPath(path);
  14.     SetDirty(FALSE);
  15.   }
  16.   return TRUE;
  17. }
  18.  
  19. ////////////////////////////////////////////////////////////////
  20. BOOL TDIBDocument::Close()
  21. {
  22.   if (TDocument::Close())
  23.     return FALSE;
  24.  
  25.   hDIB = 0;
  26.   return TRUE;
  27. }
  28.  
  29. ////////////////////////////////////////////////////////////////
  30. BOOL TDIBDocument::Commit(BOOL force)
  31. {
  32.   if (!IsDirty() && !force)
  33.     return TRUE;
  34.   imkStore((char*)GetDocPath(), (short)hDIB, IMK_EXTENSION, IMK_UNCOMP);
  35.   SetDirty(FALSE);
  36.  
  37.   return TRUE;
  38. }
  39.  
  40. ////////////////////////////////////////////////////////////////
  41. BOOL TDIBDocument::Revert(BOOL clear)
  42. {
  43.   if (!TDocument::Revert(clear))
  44.     return FALSE;
  45.   if (!clear)
  46.     Open(0);
  47.  
  48.   return TRUE;
  49. }
  50.  
  51. ////////////////////////////////////////////////////////////////
  52. BOOL TDIBDocument::IsOpen()
  53. {
  54.   return (BOOL)hDIB;
  55. }
  56.  
  57. ////////////////////////////////////////////////////////////////
  58. BOOL TDIBDocument::SetHDIB(const HDIB& newHDIB)
  59. {
  60.   hDIB = newHDIB;
  61.   SetDirty(TRUE);
  62.   return TRUE;
  63. }
  64.