Subversion Repositories Kolibri OS

Rev

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

  1. //Leency 2008-2013
  2.  
  3. #ifdef LANG_RUS
  4. char *captions[] = {
  5.         "Žâªàëâì",               "Enter",
  6.         "Žâªàëâì á ¯®¬®éìî...",  "CrlEnt",
  7.         "Žâªàëâì ª ª ⥪áâ",     "F3",
  8.         "Žâªàëâì ª ª HEX",       "F4",
  9.         //
  10.         "Š®¯¨à®¢ âì",            "Crl+C",
  11.         "‚ë१ âì",              "Crl+X",
  12.         "‚áâ ¢¨âì",              "Crl+V",
  13.         "¥à¥¨¬¥­®¢ âì",         "F2",
  14.         "“¤ «¨âì",               "Del",
  15.         "Ž¡­®¢¨âì",              "F5",
  16.         0, 0};
  17. #elif LANG_EST
  18. char *captions[] = {
  19.         "Ava",            "Enter",
  20.         "Ava ...",        "CrlEnt",
  21.         "Vaata tekstina", "F3",
  22.         "Vaata HEX",      "F4",
  23.         //
  24.         "Kopeeri",        "Crl+C",
  25.         "Lõika",          "Crl+X",
  26.         "Aseta",          "Crl+V",
  27.         "Nimeta ümber",   "F2",
  28.         "Kustuta",        "Del",
  29.         "Värskenda",      "F5",
  30.         0, 0};
  31. #else
  32. char *captions[] = {
  33.         "Open",          "Enter",
  34.         "Open with...",  "CrlEnt",
  35.         "View as text",  "F3",
  36.         "View as HEX",   "F4",
  37.         //
  38.         "Copy",          "Crl+C",
  39.         "Cut",           "Crl+X",
  40.         "Paste",         "Crl+V",
  41.         "Rename",        "F2",
  42.         "Delete",        "Del",
  43.         "Refresh",       "F5",
  44.         0, 0};
  45. #endif
  46.  
  47. proc_info MenuForm;
  48.  
  49. void FileMenu()
  50. {
  51.         mouse mm;
  52.         word id, key, slot, index;
  53.         int ccount=0, cur, newi, linew=10, lineh=18, texty;
  54.         for (index=0; captions[index]!=0; index+=2)
  55.         {
  56.                 ccount++;
  57.                 if (strlen(captions[index])>linew) linew = strlen(captions[index]);
  58.         }
  59.         linew = linew + 3 * 6 + 50;
  60.         texty = lineh/2-4;
  61.         SetEventMask(100111b);
  62.  
  63.         goto _MENU_DRAW;
  64.         loop() switch(WaitEvent())
  65.         {
  66.                 case evMouse:
  67.                                 slot = GetProcessSlot(MenuForm.ID);
  68.                                 if (slot != GetActiveProcess()) ExitProcess();
  69.                                 mm.get();
  70.                                 newi = mm.y - 1 / lineh;
  71.                                 if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1;
  72.                                 if (cur<>newi)
  73.                                 {
  74.                                         cur=newi;
  75.                                         goto _ITEMS_DRAW;
  76.                                 }
  77.                                 break;
  78.  
  79.                 case evButton:
  80.                                 id=GetButtonID();
  81.                                 if (id==100) Open();
  82.                                 if (id==101) notify("Not compleated yet");
  83.                                 if (id==102) FnProcess(3); //F3
  84.                                 if (id==103) FnProcess(4); //F4
  85.                                 if (id==104) Copy(#file_path, NOCUT);
  86.                                 if (id==105) Copy(#file_path, CUT);
  87.                                 if (id==106) CreateThread(#Paste,#copy_stak);
  88.                                 if (id==107) FnProcess(2);
  89.                                 if (id==108) Del_Form();
  90.                                 if (id==109) FnProcess(5);
  91.                                 ExitProcess();
  92.                                 break;
  93.                                
  94.                 case evKey:
  95.                                 IF (GetKey()==27) ExitProcess();
  96.                                 break;
  97.                                
  98.                 case evReDraw: _MENU_DRAW:
  99.                                 DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF);
  100.                                 GetProcessInfo(#MenuForm, SelfInfo);
  101.                                 DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border);
  102.                                 DrawBar(1,1,linew,1,0xFFFfff);
  103.                                 DrawPopupShadow(1,1,linew,ccount*lineh,0);
  104.  
  105.                                 _ITEMS_DRAW:
  106.                                 for (index=0; captions[index*2]!=0; index++)
  107.                                 {
  108.                                         DefineButton(1,index*lineh+1,linew,lineh-1,index+100+BT_HIDE+BT_NOFRAME,0xFFFFFF);
  109.                                         DrawBar(1,index*lineh+2,1,lineh,0xFFFfff);
  110.                                         if (index==cur)
  111.                                         {
  112.                                                 DrawBar(2,index*lineh+2,linew-1,lineh,0xFFFfff);
  113.                                         }
  114.                                         else
  115.                                         {
  116.                                                 DrawBar(2,index*lineh+2,linew-1,lineh,col_work);
  117.                                                 WriteText(8,index*lineh+texty+3,0x80,0xf2f2f2,captions[index*2]);
  118.                                         }
  119.                                         WriteText(7,index*lineh+texty+2,0x80,0x000000,captions[index*2]);
  120.                                         WriteText(-strlen(captions[index*2+1])*6-6+linew,index*lineh+texty+2,0x80,0x888888,captions[index*2+1]);
  121.                                 }
  122.         }
  123. }