Subversion Repositories Kolibri OS

Rev

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

  1.  
  2. //===================================================//
  3. //                                                   //
  4. //                      PATH                         //
  5. //                                                   //
  6. //===================================================//
  7.  
  8. char work_area_pointer[1024];
  9. PathShow_data PathShow = {0, 17,250, 6, 250, 0, 0, 0x000000, 0xFFFFCC, NULL, #work_area_pointer, 0};
  10. void DrawPathBar()
  11. {
  12.         if (efm) {
  13.                 DrawPathBarKfm();
  14.                 return;
  15.         }
  16.  
  17.         if (show_breadcrumb.checked) {
  18.                 DrawBreadCrumbs();
  19.                 return;
  20.         }
  21.  
  22.         PathShow.text_pointer = location[0];
  23.         PathShow.start_x = 250;
  24.         PathShow.start_y = 17;
  25.         PathShow.area_size_x = Form.cwidth-300;
  26.         DrawBar(PathShow.start_x-3, PathShow.start_y-6, PathShow.area_size_x+3, 19, col.odd_line);
  27.         DrawRectangle(PathShow.start_x-4,PathShow.start_y-7,PathShow.area_size_x+4,20,sc.work_graph);
  28.         DefineHiddenButton(PathShow.start_x-4+1,PathShow.start_y-7+1,PathShow.area_size_x+4-2,20-2,PATH_BTN);
  29.         DrawBar(PathShow.start_x-4, PathShow.start_y+14, PathShow.area_size_x+5+18, 1, sc.work_light);
  30.  
  31.         DrawFlatButtonSmall(PathShow.start_x+PathShow.area_size_x,PathShow.start_y-7,18,20, 61, "\26");
  32.  
  33.         PathShow.font_color = col.list_gb_text;
  34.         PathShow_prepare stdcall(#PathShow);
  35.         PathShow_draw stdcall(#PathShow);
  36. }
  37.  
  38. void DrawPathBarKfm()
  39. {
  40.         dword bgc;
  41.         int i=0;
  42.         if (!Form.cwidth) return;
  43.  
  44.         if (skin_is_dark()) {
  45.                 bgc = col.odd_line;
  46.                 PathShow.font_color = col.list_gb_text;
  47.         } else {
  48.                 bgc = 0xFFFFCC;
  49.                 PathShow.font_color = 0x222222;
  50.         }
  51.         PathShow.start_y = Form.cheight - status_bar_h+2;
  52.  
  53.         PathShow.start_x = 4;
  54.         PathShow.area_size_x = Form.cwidth/2-8;
  55.         do {
  56.                 DrawBar(PathShow.start_x-2,PathShow.start_y-3,PathShow.area_size_x+5,14,bgc);
  57.                 DrawRectangle(PathShow.start_x-3,PathShow.start_y-4,PathShow.area_size_x+6,15,sc.work_graph);
  58.                 PathShow.text_pointer = location[i];
  59.                 PathShow_prepare stdcall(#PathShow);
  60.                 PathShow_draw stdcall(#PathShow);
  61.                
  62.                 PathShow.start_x = Form.cwidth/2 + 2;
  63.                 PathShow.area_size_x = Form.cwidth - PathShow.start_x - 5;             
  64.                 i++;
  65.         } while (i<2);
  66.  
  67.         DrawBar(0,PathShow.start_y-2,1,15,sc.work);
  68.         DrawBar(Form.cwidth-1,PathShow.start_y-2,1,15,sc.work);
  69.         DrawBar(1,PathShow.start_y+12,Form.cwidth-2,1,sc.work_light);
  70. }
  71.  
  72. //===================================================//
  73. //                                                   //
  74. //                   BREADCRUMBS                     //
  75. //                                                   //
  76. //===================================================//
  77.  
  78. void DrawBreadCrumbs()
  79.  collection_int breadCrumb=0;
  80.  char PathShow_path[4096];
  81.  block btn;
  82.  int i;
  83.  unsigned text_line;
  84.  {
  85.         strcat(#PathShow_path, path);
  86.         for (i=0; i<50; i++) DeleteButton(i+BREADCRUMB_ID);
  87.         breadCrumb.drop();
  88.         for (i=0; (PathShow_path[i]) && (i<sizeof(PathShow_path)-1); i++)
  89.         {
  90.                 if (PathShow_path[i]=='/') {
  91.                         PathShow_path[i] = NULL;
  92.                         breadCrumb.add(i+1);
  93.                 }
  94.         }
  95.         breadCrumb.add(i+1);
  96.         btn.set_size(246,10,NULL,20);
  97.         //area_w = Form.cwidth - btn.x - 20;
  98.         for (i=0; i<breadCrumb.count-1; i++)
  99.         {
  100.                 text_line = breadCrumb.get(i) + #PathShow_path;
  101.                 btn.w = strlen(text_line)*8+10;
  102.                 DrawBreadcrumbButton(btn.x, btn.y, btn.w, btn.h, i+BREADCRUMB_ID, text_line);
  103.                 btn.x += btn.w;
  104.         }
  105.         //DrawFavButton(btn.x);
  106.         //btn.x+=20;
  107.         btn.x++;
  108.         DrawBar(btn.x,btn.y-1,Form.cwidth-btn.x-25,btn.h+3,sc.work);
  109. }
  110.  
  111.  
  112. void ClickOnBreadCrumb(unsigned clickid)
  113. {
  114.         int i, slashpos = path;
  115.         for (i=0; i!=clickid+2; i++) {
  116.                 slashpos=strchr(slashpos,'/')+1;
  117.         }
  118.         ESBYTE[slashpos-1] = NULL;
  119.         Open_Dir(path,WITH_REDRAW);
  120. }
  121.  
  122.  
  123. void DrawBreadcrumbButton(dword x,y,w,h,id,text)
  124. {
  125.         int i;
  126.         DrawRectangle(x,y,w,h,sc.work_graph);
  127.         for (i=0; (i<h-1) & (i<20); i++) DrawBar(x+1, y+i+1, w-1, 1, col.work_gradient[20-i]);
  128.         DrawRectangle3D(x+1,y+1,w-2,h-2,sc.work_light, sc.work_dark);
  129.         DefineHiddenButton(x+1,y+1,w-2,h-2,id);
  130.         WriteText(-strlen(text)*8+w/2+x,h/2+y-7,0x90,sc.work_text,text);
  131.         DrawBar(x, y+h+1, w+1, 1, sc.work_light);
  132. }