Subversion Repositories Kolibri OS

Rev

Rev 2591 | Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. //06.04.2012
  2.  
  3. #define MAX_HISTORY_NUM 40
  4. path_string history_list[MAX_HISTORY_NUM];
  5. int history_num;
  6. int history_current;
  7.  
  8. #define add_new_path 1
  9. #define go_back 2
  10. #define go_forward 3
  11.  
  12. dword GetCurrentFolder()
  13. {
  14.         char cur_fol[4096];
  15.         copystr(#path,#cur_fol);
  16.         cur_fol[strlen(#cur_fol)-1]=0x00; //îáðåçàåì ïîñëåäíèé /
  17.         copystr(#cur_fol+find_symbol(#cur_fol,'/'),#cur_fol);
  18.         return #cur_fol;
  19. }
  20.  
  21. void HistoryPath(byte action)
  22. {
  23.         if (action==add_new_path)
  24.         {
  25.                 if (history_num>0) && (strcmp(#path,#history_list[history_current].Item)==0) return;
  26.                        
  27.                 if (history_current>=MAX_HISTORY_NUM-1)
  28.                 {
  29.                         history_current/=2;
  30.                         for (i=0; i<history_current; i++;)
  31.                         {
  32.                                 copystr(#history_list[MAX_HISTORY_NUM-i].Item, #history_list[i].Item);
  33.                         }      
  34.                 }
  35.                 history_current++;
  36.                 copystr(#path,#history_list[history_current].Item);
  37.                 history_num=history_current;
  38.         }
  39.        
  40.         if (action==go_back)
  41.         {
  42.                 if (history_current<=2) return;
  43.                 history_current--;
  44.                 copystr(#history_list[history_current].Item,#path);
  45.         }
  46.  
  47.         if (action==go_forward)
  48.         {
  49.                 if (history_current==history_num) return;
  50.                 history_current++;
  51.                 copystr(#history_list[history_current].Item,#path);
  52.                 SelectFile("");
  53.         }      
  54. }