Subversion Repositories Kolibri OS

Rev

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

  1. //Leency - 2012-2013
  2.  
  3. char *ITEMS_LIST[]={
  4. "WIN                  F5",54,
  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. #else
  12. "View source          F3",52,
  13. "Free image cache"       ,02,
  14. #endif
  15. 0};
  16.  
  17.  
  18. void menu_rmb()
  19. {
  20.         mouse mm;
  21.         proc_info MenuForm;
  22.         llist menu;
  23.         int overid, key, N;
  24.         dword col_work    = 0xE4DFE1;
  25.         dword col_border  = 0x9098B0;
  26.  
  27.         menu.w = 165;
  28.         menu.line_h = 19;
  29.         menu.first = 0;
  30.         while (ITEMS_LIST[menu.count*2]) {menu.count++; menu.visible++;}
  31.         SetEventMask(100111b);
  32.  
  33.         loop() switch(WaitEvent())
  34.         {
  35.         case evMouse:
  36.                                 GetProcessInfo(#MenuForm, SelfInfo);
  37.                                 N=GetProcessSlot(MenuForm.ID);
  38.                                 if (N<>GetActiveProcess()) ExitProcess();
  39.  
  40.                                 mm.get();                              
  41.                                 overid=mm.y/menu.line_h;
  42.                                 if (overid<0) || (overid+1>menu.count) || (mm.x<0) || (mm.x>menu.w) break;
  43.                                 if (mm.lkm) || (mm.pkm)
  44.                                 {
  45.                                         action_buf = ITEMS_LIST[menu.current*2+1];
  46.                                         ExitProcess();
  47.                                 }
  48.                                 if (menu.current<>overid)
  49.                                 {
  50.                                         menu.current=overid;
  51.                                         goto _ITEMS_DRAW;
  52.                                 }
  53.                                 break;
  54.                                
  55.                 case evKey:
  56.                                 key = GetKey();
  57.                                 if (key==27) ExitProcess();
  58.                                 if (menu.ProcessKey(key)) goto _ITEMS_DRAW;
  59.                                 if (key==13)
  60.                                 {
  61.                                         action_buf = ITEMS_LIST[menu.current*2+1];
  62.                                         ExitProcess();
  63.                                 }
  64.                                 break;
  65.                                
  66.                 case evReDraw:
  67.                                 DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.count*menu.line_h+4,0x01, 0, 0, 0x01fffFFF);
  68.                                 DrawPopup(0,0,menu.w,menu.count*menu.line_h+3,0, col_work,col_border);
  69.  
  70.                                 _ITEMS_DRAW:
  71.                                 for (N=0; N<menu.count; N++;)
  72.                                 {
  73.                                         if (N==menu.current)
  74.                                                 DrawBar(2, N*menu.line_h+2, menu.w-3, menu.line_h, 0x94AECE);
  75.                                         else
  76.                                         {
  77.                                                 DrawBar(2, N*menu.line_h+2, menu.w-3, menu.line_h, col_work);
  78.                                                 WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N*2]);
  79.                                         }
  80.                                         WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
  81.                                 }
  82.                                 DrawBar(7, cur_encoding*menu.line_h+9, 4, 4, 0x444444); //show current encoding
  83.         }
  84. }
  85.  
  86.  
  87.  
  88.  
  89.  
  90.