Subversion Repositories Kolibri OS

Rev

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