Subversion Repositories Kolibri OS

Rev

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

  1. //Leency - 2012-2013
  2.  
  3. char *ITEMS_LIST[]={
  4. "WIN              Ctrl+E",05,
  5. "DOS              Ctrl+D",04,
  6. "KOI              Ctrl+K",11,
  7. "UTF              Ctrl+U",21,
  8. #ifdef LANG_RUS
  9. "ˆá室­¨ª áâà ­¨æë    F3",52,
  10. "Žç¨áâ¨âì ªíè ª à⨭®ª"  ,02,
  11. "ˆáâ®à¨ï"                ,08,
  12. #else
  13. "View source          F3",52,
  14. "Free image cache"       ,09,
  15. "History"                ,08,
  16. #endif
  17. 0};
  18.  
  19. llist menu;
  20. dword col_work    = 0xE4DFE1;
  21. dword col_border  = 0x9098B0;
  22.  
  23. void menu_rmb()
  24. {
  25.         mouse mm;
  26.         proc_info MenuForm;
  27.         int key;
  28.  
  29.         menu.first = menu.current = 0;
  30.         while (ITEMS_LIST[menu.count*2]) menu.count++;
  31.         menu.SetSizes(2,2,165,menu.count*19,0,19);
  32.         SetEventMask(100111b);
  33.  
  34.         loop() switch(WaitEvent())
  35.         {
  36.         case evMouse:
  37.                                 GetProcessInfo(#MenuForm, SelfInfo);
  38.                                 if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
  39.  
  40.                                 mm.get();
  41.                                 if (menu.ProcessMouse(mm.x, mm.y)) DrawMenuList();
  42.                                 if (mm.lkm) || (mm.pkm) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); }
  43.                                 break;
  44.                                
  45.                 case evKey:
  46.                                 key = GetKey();
  47.                                 if (key==27) ExitProcess();
  48.                                 if (menu.ProcessKey(key)) DrawMenuList();
  49.                                 if (key==13)
  50.                                 {
  51.                                         action_buf = ITEMS_LIST[menu.current*2+1];
  52.                                         ExitProcess();
  53.                                 }
  54.                                 break;
  55.                                
  56.                 case evReDraw:
  57.                                 DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
  58.                                 DrawPopup(0,0,menu.w,menu.h+3,0, col_work,col_border);
  59.                                 DrawMenuList();                        
  60.         }
  61. }
  62.  
  63. void DrawMenuList()
  64. {
  65.         int N;
  66.  
  67.         for (N=0; N<menu.count; N++;)
  68.         {
  69.                 if (N==menu.current)
  70.                         DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, 0x94AECE);
  71.                 else
  72.                 {
  73.                         DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, col_work);
  74.                         WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N*2]);
  75.                 }
  76.                 WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
  77.         }
  78.         DrawBar(7, cur_encoding*menu.line_h+9, 4, 4, 0x444444); //show current encoding
  79. }
  80.