Subversion Repositories Kolibri OS

Rev

Rev 5825 | Rev 7051 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. //Leency 2008-2013
  2.  
  3. //pay attension: >200 this is only file actions, not supported by folders
  4. #ifdef LANG_RUS
  5. char *file_captions[] = {
  6.         "Žâªàëâì",               "Enter",100,
  7.         "Žâªàëâì á ¯®¬®éìî...",  "CrlEnt",201,
  8.         "Žâªàëâì ª ª ⥪áâ",     "F3",202,
  9.         "Žâªàëâì ª ª HEX",       "F4",203,
  10.         "Š®¯¨à®¢ âì",            "Crl+C",104,
  11.         "‚ë१ âì",              "Crl+X",105,
  12.         "‚áâ ¢¨âì",              "Crl+V",106,
  13.         "¥à¥¨¬¥­®¢ âì",         "F2",207,
  14.         "“¤ «¨âì",               "Del",108,
  15.         "Ž¡­®¢¨âì ¯ ¯ªã",        "F5",109,
  16.         "‘¢®©á⢠",              "",110,
  17.         0, 0, 0};
  18. #elif LANG_EST
  19. char *file_captions[] = {
  20.         "Ava",            "Enter",100,
  21.         "Ava ...",        "CrlEnt",201,
  22.         "Vaata tekstina", "F3",202,
  23.         "Vaata HEX",      "F4",203,
  24.         "Kopeeri",        "Crl+C",104,
  25.         "Lõika",          "Crl+X",105,
  26.         "Aseta",          "Crl+V",106,
  27.         "Nimeta ümber",   "F2",207,
  28.         "Kustuta",        "Del",108,
  29.         "Värskenda",      "F5",109,
  30.         "Properties",       "",110,
  31.         0, 0, 0};
  32. #else
  33. char *file_captions[] = {
  34.         "Open",          "Enter",100,
  35.         "Open with...",  "CrlEnt",201,
  36.         "View as text",  "F3",202,
  37.         "View as HEX",   "F4",203,
  38.         "Copy",          "Crl+C",104,
  39.         "Cut",           "Crl+X",105,
  40.         "Paste",         "Crl+V",106,
  41.         "Rename",        "F2",207,
  42.         "Delete",        "Del",108,
  43.         "Refresh",       "F5",109,
  44.         "Properties",       "",110,
  45.         0, 0, 0};
  46. #endif
  47.  
  48. llist menu;
  49. int cur_action_buf;
  50.  
  51. void FileMenu()
  52. {
  53.         proc_info MenuForm;
  54.         int index;
  55.  
  56.         menu.ClearList();
  57.         menu.SetFont(6, 9, 0x80);
  58.         menu.SetSizes(0,0,10,0,18);
  59.         for (index=0; file_captions[index]!=0; index+=3)
  60.         {
  61.                 if (itdir) && (file_captions[index+2]>=200) continue;
  62.                 if (strlen(file_captions[index])>menu.w) menu.w = strlen(file_captions[index]);
  63.                 menu.count++;
  64.                 menu.visible++;
  65.         }
  66.         menu.w = menu.w + 3 * menu.font_w + 50;
  67.         menu.h = menu.count * menu.item_h;
  68.         SetEventMask(100111b);
  69.         goto _MENU_DRAW;
  70.        
  71.         loop() switch(WaitEvent())
  72.         {
  73.                 case evMouse:
  74.                                 mouse.get();
  75.                                 if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();}
  76.                                 else if (mouse.move)&&(menu.ProcessMouse(mouse.x, mouse.y)) MenuListRedraw();
  77.                                 else if (mouse.key&MOUSE_LEFT)&&(mouse.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
  78.                 break;
  79.                                
  80.                 case evKey:
  81.                                 GetKeys();
  82.                                 if (key_scancode == SCAN_CODE_ESC) {cmd_free=1;ExitProcess();}
  83.                                 if (key_scancode == SCAN_CODE_ENTER) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
  84.                                 if (menu.ProcessKey(key_scancode)) MenuListRedraw();
  85.                                 break;
  86.                                
  87.                 case evReDraw: _MENU_DRAW:
  88.                                 if (menu_call_mouse) DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+GetSkinHeight(),menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
  89.                                 else DefineAndDrawWindow(Form.left+files.x+15, files.item_h*files.cur_y+files.y+Form.top+30,menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
  90.                                 GetProcessInfo(#MenuForm, SelfInfo);
  91.                                 DrawRectangle(0,0,menu.w+1,menu.h+2,col_graph);
  92.                                 DrawBar(1,1,menu.w,1,0xFFFfff);
  93.                                 DrawPopupShadow(1,1,menu.w,menu.h,0);
  94.                                 MenuListRedraw();
  95.         }
  96. }
  97.  
  98. void MenuListRedraw()
  99. {
  100.         int start_y=0;
  101.         int index;
  102.         for (index=0; file_captions[index*3]!=0; index++)
  103.         {
  104.                 if ((itdir) && (file_captions[index*3+2]>=200)) continue;
  105.                 DrawBar(1,start_y+2,1,menu.item_h,0xFFFfff);
  106.                 if (start_y/menu.item_h==menu.cur_y)
  107.                 {
  108.                         cur_action_buf = file_captions[index*3+2];
  109.                         DrawBar(2,start_y+2,menu.w-1,menu.item_h,0xFFFfff);
  110.                 }
  111.                 else
  112.                 {
  113.                         DrawBar(2,start_y+2,menu.w-1,menu.item_h,col_work);
  114.                         WriteText(8,start_y+menu.text_y+4,menu.font_type,0xf2f2f2,file_captions[index*3]);
  115.                 }
  116.                 WriteText(7, start_y + menu.text_y + 3, menu.font_type, 0, file_captions[index*3]);
  117.                 WriteText(-strlen(file_captions[index*3+1])-1*menu.font_w + menu.w, start_y + menu.text_y + 3, menu.font_type, 0x888888, file_captions[index*3+1]);
  118.                 start_y+=menu.item_h;
  119.         }      
  120. }