Subversion Repositories Kolibri OS

Rev

Rev 5519 | 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. "Zoom 2x                 Z",122,
  10. "®á¬®âà¥âì ¨á室­¨ª    F3",52,
  11. "¥¤ ªâ¨à®¢ âì ¨á室­¨ª F4",53,
  12. "Žç¨áâ¨âì ªíè ª à⨭®ª"    ,02,
  13. "ˆáâ®à¨ï"                  ,03,
  14. "Œ¥­¥¤¦¥à § £à㧮ª"        ,06,
  15. #else
  16. "Zoom 2x                 Z",122,
  17. "View source            F3",52,
  18. "Edit source            F4",53,
  19. "Free image cache"         ,09,
  20. "History"                  ,03,
  21. "Download Manager"         ,06,
  22. #endif
  23. 0};
  24.  
  25. llist menu;
  26.  
  27. void menu_rmb()
  28. {
  29.         mouse mm;
  30.         proc_info MenuForm;
  31.         int key;
  32.  
  33.         menu.first = menu.current = 0;
  34.         while (ITEMS_LIST[menu.count*2]) menu.count++;
  35.         menu.SetSizes(2,2,177,menu.count*19,0,19);
  36.         SetEventMask(100111b);
  37.  
  38.         _BEGIN_APPLICATION_MENU:
  39.         switch(WaitEvent())
  40.         {
  41.         case evMouse:
  42.                                 GetProcessInfo(#MenuForm, SelfInfo);
  43.                                 if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
  44.  
  45.                                 mm.get();
  46.                                 if (menu.ProcessMouse(mm.x, mm.y)) DrawMenuList();
  47.                                 if (mm.lkm)&&(mm.up) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); }
  48.                                 break;
  49.                                
  50.                 case evKey:
  51.                                 key = GetKey();
  52.                                 if (key==27) ExitProcess();
  53.                                 if (menu.ProcessKey(key)) DrawMenuList();
  54.                                 if (key==13)
  55.                                 {
  56.                                         action_buf = ITEMS_LIST[menu.current*2+1];
  57.                                         ExitProcess();
  58.                                 }
  59.                                 break;
  60.                                
  61.                 case evReDraw:
  62.                                 DefineAndDrawWindow(Form.left+m.x-6,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
  63.                                 DrawPopup(0,0,menu.w,menu.h+3,0, col_bg,border_color);
  64.                                 DrawMenuList();                        
  65.         }
  66.         goto _BEGIN_APPLICATION_MENU;
  67. }
  68.  
  69. void DrawMenuList()
  70. {
  71.         int N;
  72.  
  73.         for (N=0; N<menu.count; N++;)
  74.         {
  75.                 if (N==menu.current)
  76.                         DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, 0x94AECE);
  77.                 else
  78.                 {
  79.                         DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, col_bg);
  80.                         WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N*2]);
  81.                 }
  82.                 WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
  83.         }
  84.         if (cur_encoding!=_DEFAULT)
  85.                 WriteText(5, cur_encoding*menu.line_h+7, 0x80, 0x777777, "\x10"); //show current encoding
  86.         else
  87.                 WriteText(5, _DOS*menu.line_h+7, 0x80, 0x777777, "\x10"); //show current encoding
  88.  
  89.         if (WB1.DrawBuf.zoomf == 2) DrawBar(6, 4*menu.line_h+8, 6, 6, 0x777777);
  90. }
  91.