Subversion Repositories Kolibri OS

Rev

Rev 5640 | 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.         proc_info MenuForm;
  30.         int key;
  31.  
  32.         menu.first = menu.current = 0;
  33.         while (ITEMS_LIST[menu.count*2]) menu.count++;
  34.         menu.SetSizes(2,2,177,menu.count*19,0,19);
  35.         SetEventMask(100111b);
  36.  
  37.         _BEGIN_APPLICATION_MENU:
  38.         switch(WaitEvent())
  39.         {
  40.         case evMouse:
  41.                                 GetProcessInfo(#MenuForm, SelfInfo);
  42.                                 if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
  43.  
  44.                                 mouse.get();
  45.                                 if (menu.ProcessMouse(mouse.x, mouse.y)) DrawMenuList();
  46.                                 if (mouse.lkm)&&(mouse.up) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); }
  47.                                 break;
  48.                                
  49.                 case evKey:
  50.                                 key = GetKey();
  51.                                 if (key==27) ExitProcess();
  52.                                 if (menu.ProcessKey(key)) DrawMenuList();
  53.                                 if (key==13)
  54.                                 {
  55.                                         action_buf = ITEMS_LIST[menu.current*2+1];
  56.                                         ExitProcess();
  57.                                 }
  58.                                 break;
  59.                                
  60.                 case evReDraw:
  61.                                 DefineAndDrawWindow(Form.left+mouse.x-6,Form.top+mouse.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
  62.                                 DrawPopup(0,0,menu.w,menu.h+3,0, col_bg,border_color);
  63.                                 DrawMenuList();                        
  64.         }
  65.         goto _BEGIN_APPLICATION_MENU;
  66. }
  67.  
  68. void DrawMenuList()
  69. {
  70.         int N;
  71.  
  72.         for (N=0; N<menu.count; N++;)
  73.         {
  74.                 if (N==menu.current)
  75.                         DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, 0x94AECE);
  76.                 else
  77.                 {
  78.                         DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, col_bg);
  79.                         WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N*2]);
  80.                 }
  81.                 WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
  82.         }
  83.         if (cur_encoding!=_DEFAULT)
  84.                 WriteText(5, cur_encoding*menu.line_h+7, 0x80, 0x777777, "\x10"); //show current encoding
  85.         else
  86.                 WriteText(5, _DOS*menu.line_h+7, 0x80, 0x777777, "\x10"); //show current encoding
  87.  
  88.         if (WB1.DrawBuf.zoom == 2) DrawBar(6, 4*menu.line_h+8, 6, 6, 0x777777);
  89. }
  90.