Subversion Repositories Kolibri OS

Rev

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.         int i;
  27.         if (history_num>0) && (!strcmp(#URL,#history_list[history_current].Item)) return;
  28.  
  29.         if (history_current>=MAX_HISTORY_NUM-1)
  30.         {
  31.                 history_current/=2;
  32.                 for (i=0; i<history_current; i++;)
  33.                 {
  34.                         strlcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item, sizeof(history_list[0].Item));
  35.                 }      
  36.         }
  37.         history_current++;
  38.         strlcpy(#history_list[history_current].Item, #URL, sizeof(history_list[0].Item));
  39.         history_num=history_current;
  40. }
  41.  
  42.  
  43. byte UrlsHistory::GoBack()
  44. {
  45.         if (history_current<=1) return 0;
  46.        
  47.         history_current--;
  48.         strlcpy(#URL, #history_list[history_current].Item, sizeof(URL));
  49.         return 1;
  50. }
  51.  
  52.  
  53. byte UrlsHistory::GoForward()
  54. {
  55.         if (history_current==history_num) return 0;
  56.         history_current++;
  57.         strlcpy(#URL, #history_list[history_current].Item, sizeof(URL));
  58.         return 1;
  59. }