Subversion Repositories Kolibri OS

Rev

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

  1. //Leency - 2012
  2.  
  3. #define add_new_path 1
  4. #define go_back 2
  5.  
  6. void HistoryPath(byte action)
  7. {
  8.         if (action==add_new_path)
  9.         {
  10.                 IF (strcmp(#PathHistory+find_symbol(#PathHistory,'|'),#path)==0) return;
  11.                 IF (strlen(#PathHistory)+strlen(#path)>2560)
  12.                 {
  13.                         copystr(#PathHistory+1024,#PathHistory);
  14.                         copystr("/",#PathHistory+strlen(#PathHistory));
  15.                 }
  16.                 copystr("|",#PathHistory+strlen(#PathHistory));
  17.                 copystr(#path,#PathHistory+strlen(#PathHistory));
  18.         }
  19.         if (action==go_back)
  20.         {
  21.                 i=strlen(#PathHistory)-1;
  22.                 WHILE (PathHistory[i]<>'|') { i--; };
  23.                 IF (i>0) PathHistory[i]=0x00;
  24.                 WHILE (PathHistory[i]<>'|')     { copystr(#PathHistory[i],#path); i--;  }
  25.                 IF (i>0) PathHistory[i]=0x00;
  26.         }
  27. }
  28.  
  29.  
  30. dword onLeft(dword right,left) {EAX=Form.width-right-left;}
  31. dword onTop(dword down,up) {EAX=Form.height-GetSkinWidth()-down-up;}
  32.  
  33.  
  34. void ShowMessage(dword message)
  35. {
  36.         DrawFlatButton(Form.width/2-13,160,200,80,0,0xFFB6B5, message);
  37.         Pause(150);
  38.         List_ReDraw();
  39. }
  40.  
  41.  
  42. dword ConvertSize(dword bytes)
  43. {
  44.         byte size_prefix[8], temp[3];
  45.         IF (bytes>=1073741824) copystr(" Gb",#temp);
  46.         ELSE IF (bytes>=1048576) copystr(" Mb",#temp);
  47.         ELSE IF (bytes>=1024) copystr(" Kb",#temp);
  48.         ELSE copystr(" b ",#temp);
  49.         WHILE (bytes>1023) bytes/=1024;
  50.         copystr(IntToStr(bytes),#size_prefix);
  51.         copystr(#temp,#size_prefix+strlen(#size_prefix));
  52.         EAX=#size_prefix;
  53. }
  54.