Subversion Repositories Kolibri OS

Rev

Rev 4026 | 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.         while (ITEMS_LIST[menu.count*2]) menu.count++;
  30.         SetEventMask(100111b);
  31.  
  32.         loop() switch(WaitEvent())
  33.         {
  34.         case evMouse:
  35.                                 GetProcessInfo(#MenuForm, SelfInfo);
  36.                                 N=GetProcessSlot(MenuForm.ID);
  37.                                 if (N<>GetActiveProcess()) ExitProcess();
  38.  
  39.                                 mm.get();                              
  40.                                 overid=mm.y/menu.line_h;
  41.                                 if (overid<0) || (overid+1>menu.count) || (mm.x<0) || (mm.x>menu.w) break;
  42.                                 if (mm.lkm) || (mm.pkm)
  43.                                 {
  44.                                         action_buf = ITEMS_LIST[menu.current*2+1];
  45.                                         ExitProcess();
  46.                                 }
  47.                                 if (menu.current<>overid)
  48.                                 {
  49.                                         menu.current=overid;
  50.                                         goto _ITEMS_DRAW;
  51.                                 }
  52.                                 break;
  53.                                
  54.                 case evKey:
  55.                                 key = GetKey();
  56.                                 if (key==27) ExitProcess();
  57.                                 if (key==178) && (menu.current)
  58.                                 {
  59.                                         menu.current--;
  60.                                         goto _ITEMS_DRAW;
  61.                                 }
  62.                                 if (key==177) && (menu.current+1<menu.count)
  63.                                 {
  64.                                         menu.current++;
  65.                                         goto _ITEMS_DRAW;
  66.                                 }
  67.                                 if (key==13)
  68.                                 {
  69.                                         action_buf = ITEMS_LIST[menu.current*2+1];
  70.                                         ExitProcess();
  71.                                 }
  72.                                 break;
  73.                                
  74.                 case evReDraw:
  75.                                 DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.count*menu.line_h+4,0x01, 0, 0, 0x01fffFFF);
  76.                                 DrawPopup(0,0,menu.w,menu.count*menu.line_h+3,0, col_work,col_border);
  77.  
  78.                                 _ITEMS_DRAW:
  79.                                 for (N=0; N<menu.count; N++;)
  80.                                 {
  81.                                         if (N==menu.current)
  82.                                                 DrawBar(2, N*menu.line_h+2, menu.w-3, menu.line_h, 0x94AECE);
  83.                                         else
  84.                                         {
  85.                                                 DrawBar(2, N*menu.line_h+2, menu.w-3, menu.line_h, col_work);
  86.                                                 WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N*2]);
  87.                                         }
  88.                                         WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
  89.                                 }
  90.                                 DrawBar(7, cur_encoding*menu.line_h+9, 4, 4, 0x444444); //show current encoding
  91.         }
  92. }
  93.  
  94.  
  95.  
  96.  
  97.  
  98.