home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 February / Chip_2001-02_cd1.bin / sharewar / vecad / source / mru.h < prev    next >
C/C++ Source or Header  |  2000-06-23  |  1KB  |  56 lines

  1. /********************************************************************
  2. * Project: VeCAD ver.5.1
  3. * Copyright (C) 1999-2000 by Oleg Kolbaskin.
  4. * All rights reserved.
  5. *
  6. * Most Recent Files (MRU)
  7. ********************************************************************/
  8. #ifndef MRU_H
  9. #define MRU_H
  10.  
  11. #ifndef _WINDOWS_
  12.   #include <windows.h>
  13. #endif
  14. #ifndef _INC_TIME
  15.   #include <time.h>
  16. #endif
  17. #ifndef CONFIG_H
  18.   #include "config.h"
  19. #endif
  20.  
  21. #define SZ_MRUFILENAME 256
  22. #define MAX_MRU  11
  23.  
  24. //-------------------------------------
  25. class CMruFile {
  26.   TCHAR  szName[SZ_MRUFILENAME];  // file name
  27.   time_t OpenTime;     // time when file was last opened
  28. public:
  29.     CMruFile();
  30.  
  31.   void    SetName (LPCTSTR szName);
  32.   LPCTSTR GetName () const {return szName;}
  33.   void    SetTime (int t=-1) {if (t>=0) OpenTime=t; else time( &OpenTime );} 
  34.   time_t  GetTime () const {return OpenTime;} 
  35. };
  36.  
  37.  
  38. //-------------------------------------
  39. class CMruList {
  40.   CMruFile File[MAX_MRU];
  41.   int  n_file;       // number of files in the list
  42. public:
  43.     CMruList ();
  44.  
  45.   void    Add  (LPCTSTR szFileName);
  46.   LPCTSTR Get  (int Index, bool bSetTime=true);
  47.   bool    Load (CConfig& Cfg);
  48.   bool    Save (CConfig& Cfg);
  49. private:
  50.   bool UpdateMenu ();
  51. };
  52.  
  53.  
  54. #endif  // MRU_H
  55.  
  56.