Subversion Repositories Kolibri OS

Rev

Rev 2739 | Blame | Last modification | View Log | Download | RSS feed

  1. struct UrlsHistory {
  2.         dword CurrentUrl();
  3.         void AddUrl();
  4.         byte GoBack();
  5.         byte GoForward();
  6. };
  7.  
  8. UrlsHistory BrowserHistory;
  9.  
  10. struct path_string {
  11. char Item[4096];
  12. };
  13.  
  14. #define MAX_HISTORY_NUM 40
  15. path_string history_list[MAX_HISTORY_NUM];
  16. int history_num;
  17. int history_current;
  18.  
  19. dword UrlsHistory::CurrentUrl()
  20. {
  21.         return #history_list[history_current].Item;
  22. }
  23.  
  24. void UrlsHistory::AddUrl() //òóò íóæåí ââîäèìûé ýëåìåíò - äëÿ óíèâåðñàëüíîñòè
  25. {
  26.         if (history_num>0) && (strcmp(#URL,#history_list[history_current].Item)==0) return;
  27.  
  28.         if (history_current>=MAX_HISTORY_NUM-1)
  29.         {
  30.                 history_current/=2;
  31.                 for (i=0; i<history_current; i++;)
  32.                 {
  33.                         strcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item);
  34.                 }      
  35.         }
  36.         history_current++;
  37.         strcpy(#history_list[history_current].Item, #URL);
  38.         history_num=history_current;
  39. }
  40.  
  41.  
  42. byte UrlsHistory::GoBack()
  43. {
  44.         if (history_current<=1) return 0;
  45.        
  46.         history_current--;
  47.         strcpy(#URL, #history_list[history_current].Item);
  48.          return 1;
  49. }
  50.  
  51.  
  52. byte UrlsHistory::GoForward()
  53. {
  54.         if (history_current==history_num) return 0;
  55.         history_current++;
  56.         strcpy(#URL, #history_list[history_current].Item);
  57.         return 1;
  58. }