Subversion Repositories Kolibri OS

Rev

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

  1. struct path_string {
  2. char Item[4096];
  3. };
  4.  
  5. #define MAX_HISTORY_NUM 40
  6. path_string history_list[MAX_HISTORY_NUM];
  7.  
  8. struct UrlsHistory {
  9.         int links_count;
  10.         int current;
  11.         dword CurrentUrl();
  12.         dword GetUrl();
  13.         void AddUrl();
  14.         byte GoBack();
  15.         byte GoForward();
  16. };
  17.  
  18. dword UrlsHistory::CurrentUrl() {
  19.         return #history_list[current].Item;
  20. }
  21.  
  22. dword UrlsHistory::GetUrl(int id) {
  23.         return #history_list[id].Item;
  24. }
  25.  
  26. void UrlsHistory::AddUrl() {
  27.         int i;
  28.         if (links_count>0) && (!strcmp(#URL,#history_list[current].Item)) return;
  29.  
  30.         if (current>=MAX_HISTORY_NUM-1)
  31.         {
  32.                 current/=2;
  33.                 for (i=0; i<current; i++;)
  34.                 {
  35.                         strlcpy(#history_list[i].Item, #history_list[MAX_HISTORY_NUM-i].Item, sizeof(history_list[0].Item));
  36.                 }      
  37.         }
  38.         current++;
  39.         strlcpy(#history_list[current].Item, #URL, sizeof(history_list[0].Item));
  40.         links_count=current;
  41. }
  42.  
  43.  
  44. byte UrlsHistory::GoBack() {
  45.         if (current<=1) return 0;
  46.         current--;
  47.         strlcpy(#URL, #history_list[current].Item, sizeof(URL));
  48.         return 1;
  49. }
  50.  
  51.  
  52. byte UrlsHistory::GoForward() {
  53.         if (current==links_count) return 0;
  54.         current++;
  55.         strlcpy(#URL, #history_list[current].Item, sizeof(URL));
  56.         return 1;
  57. }
  58.  
  59. UrlsHistory BrowserHistory;