Subversion Repositories Kolibri OS

Rev

Rev 3997 | Go to most recent revision | Blame | 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.         0, 0, 0};
  17. #elif LANG_EST
  18. char *file_captions[] = {
  19.         "Ava",            "Enter",100,
  20.         "Ava ...",        "CrlEnt",201,
  21.         "Vaata tekstina", "F3",202,
  22.         "Vaata HEX",      "F4",203,
  23.         "Kopeeri",        "Crl+C",104,
  24.         "Lõika",          "Crl+X",105,
  25.         "Aseta",          "Crl+V",106,
  26.         "Nimeta ümber",   "F2",207,
  27.         "Kustuta",        "Del",108,
  28.         "Värskenda",      "F5",109,
  29.         0, 0, 0};
  30. #else
  31. char *file_captions[] = {
  32.         "Open",          "Enter",100,
  33.         "Open with...",  "CrlEnt",201,
  34.         "View as text",  "F3",202,
  35.         "View as HEX",   "F4",203,
  36.         "Copy",          "Crl+C",104,
  37.         "Cut",           "Crl+X",105,
  38.         "Paste",         "Crl+V",106,
  39.         "Rename",        "F2",207,
  40.         "Delete",        "Del",108,
  41.         "Refresh",       "F5",109,
  42.         0, 0, 0};
  43. #endif
  44.  
  45.  
  46. void FileMenu()
  47. {
  48.         mouse mm;
  49.         word id, key, slot, index, start_y;
  50.         proc_info MenuForm;
  51.         int ccount=0, cur=0, newi, linew=10, lineh=18, texty;
  52.         for (index=0; file_captions[index]!=0; index+=3)
  53.         {
  54.                 if (itdir) && (file_captions[index+2]>=200) continue;
  55.                 if (strlen(file_captions[index])>linew) linew = strlen(file_captions[index]);
  56.                 ccount++;
  57.         }
  58.         linew = linew + 3 * 6 + 50;
  59.         texty = lineh/2-4;
  60.         SetEventMask(100111b);
  61.  
  62.         goto _MENU_DRAW;
  63.         loop() switch(WaitEvent())
  64.         {
  65.                 case evMouse:
  66.                                 slot = GetProcessSlot(MenuForm.ID);
  67.                                 if (slot != GetActiveProcess()) ExitProcess();
  68.                                 mm.get();
  69.                                 newi = mm.y - 1 / lineh;
  70.                                 if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1;
  71.                                 if (cur<>newi)
  72.                                 {
  73.                                         cur=newi;
  74.                                         goto _ITEMS_DRAW;
  75.                                 }
  76.                                 break;
  77.  
  78.                 case evButton:
  79.                                 action_buf = GetButtonID();
  80.                                 ExitProcess();
  81.                                 break;
  82.                                
  83.                 case evKey:
  84.                                 IF (GetKey()==27) ExitProcess();
  85.                                 break;
  86.                                
  87.                 case evReDraw: _MENU_DRAW:
  88.                                 DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF);
  89.                                 GetProcessInfo(#MenuForm, SelfInfo);
  90.                                 DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border);
  91.                                 DrawBar(1,1,linew,1,0xFFFfff);
  92.                                 DrawPopupShadow(1,1,linew,ccount*lineh,0);
  93.  
  94.                                 _ITEMS_DRAW:
  95.                                 for (index=0, start_y=0; file_captions[index*3]!=0; index++)
  96.                                 {
  97.                                         DefineButton(1,start_y+1,linew,lineh-1,file_captions[index*3+2]+BT_HIDE+BT_NOFRAME,0xFFFFFF);
  98.                                         if ((itdir) && (file_captions[index*3+2]>=200)) continue;
  99.                                         DrawBar(1,start_y+2,1,lineh,0xFFFfff);
  100.                                         if (start_y/lineh==cur)
  101.                                         {
  102.                                                 DrawBar(2,start_y+2,linew-1,lineh,0xFFFfff);
  103.                                         }
  104.                                         else
  105.                                         {
  106.                                                 DrawBar(2,start_y+2,linew-1,lineh,col_work);
  107.                                                 WriteText(8,start_y+texty+3,0x80,0xf2f2f2,file_captions[index*3]);
  108.                                         }
  109.                                         WriteText(7,start_y+texty+2,0x80,0x000000,file_captions[index*3]);
  110.                                         WriteText(-strlen(file_captions[index*3+1])*6-6+linew,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]);
  111.                                         start_y+=lineh;
  112.                                 }
  113.         }
  114. }