Subversion Repositories Kolibri OS

Rev

Rev 3075 | Blame | Last modification | View Log | Download | RSS feed

  1. //@RB - v0.6
  2.  
  3. #include "..\lib\kolibri.h"
  4. #include "..\lib\figures.h"
  5. #include "..\lib\file_system.h"
  6.  
  7. #ifndef AUTOBUILD
  8. #include "lang.h--"
  9. #endif
  10.  
  11. #ifdef LANG_RUS
  12.         #define ITEM_HEIGHT 18
  13.         #define ITEM_WIDTH  138
  14.         char *ITEMS_LIST[]={
  15.         "‘¬¥­¨âì ⥬㠮ª®­   ", "/sys/SKINSEL",       0,
  16.         "‚ë¡à âì 梥â ä®­    ", "/sys/media/palitra", 0,
  17.         "“¯à ¢«¥­¨¥ ¨ª®­ª ¬¨ ", "/sys/ICON",          0,
  18.         " áâனª  ãáâனá⢠", "/sys/SETUP",         0,
  19.         "Ž¡­®¢¨âì á⮫       ", "/sys/REFRSCRN",      0,
  20.         "à®æ¥ááë            ", "/sys/CPU",           0,
  21.         0};
  22. #else
  23.         #define ITEM_HEIGHT 18
  24.         #define ITEM_WIDTH  122
  25.         char *ITEMS_LIST[]={
  26.         "Window skin         ", "/sys/SKINSEL",       0,
  27.         "Background          ", "/sys/media/palitra", 0,
  28.         "Icon manager        ", "/sys/ICON",          0,
  29.         "Device setup        ", "/sys/SETUP",         0,
  30.         "Refresh desktop     ", "/sys/REFRSCRN",      0,
  31.         "Processes           ", "/sys/CPU",           0,
  32.         0};
  33. #endif
  34.  
  35. dword stak[100];
  36.  
  37.  
  38. void main()
  39. {
  40.         mouse mm;
  41.         byte thread_id;
  42.         SetEventMask(100000b);
  43.        
  44.         loop() switch(WaitEvent())
  45.         {
  46.                 case evMouse:
  47.                         mm.get();
  48.  
  49.                         if (GetPointOwner(mm.x, mm.y)==1) && (mm.pkm)
  50.                         {
  51.                                 SwitchToAnotherThread();
  52.                                 CreateThread(#window,#stak);
  53.                         }
  54.         }
  55. }
  56.  
  57.        
  58. void window()
  59. {
  60.         proc_info MenuForm;
  61.         system_colors sc;
  62.         mouse m;       
  63.         int items_num, items_cur;
  64.         int id1, key, i;
  65.        
  66.         sc.get();
  67.         SetEventMask(100111b);
  68.        
  69.         loop() switch(WaitEvent())
  70.         {
  71.         case evMouse:
  72.                                 m.get();
  73.  
  74.                                 GetProcessInfo(#MenuForm, SelfInfo);
  75.                                 id1=GetProcessSlot(MenuForm.ID);
  76.                                 if (id1<>GetActiveProcess()) ExitProcess();                    
  77.                                 id1=m.y-1/ITEM_HEIGHT;
  78.                                 if (m.y<0) || (id1+1>items_num) || (m.x<0) || (m.x>ITEM_WIDTH) break;
  79.                                 if (m.lkm) || (m.pkm)
  80.                                 {
  81.                                         //feel clicking
  82.                                         DrawBar(1, items_cur*ITEM_HEIGHT+2, ITEM_WIDTH-1, ITEM_HEIGHT-2, sc.work_graph);
  83.                                         WriteText(8,items_cur*ITEM_HEIGHT+6,0x80,sc.work_button_text,ITEMS_LIST[items_cur*3],0);
  84.                                         pause(4);
  85.                                        
  86.                                         ItemProcess(items_cur);
  87.                                 }
  88.                                 if (items_cur<>id1)
  89.                                 {
  90.                                         items_cur=id1;
  91.                                         goto _ITEMS_DRAW;
  92.                                 }
  93.                                
  94.                                 break;
  95.                                
  96.                 case evButton:
  97.                                 break;
  98.                                
  99.                 case evKey:
  100.                                 key = GetKey();
  101.                                 if (key==27) ExitProcess();
  102.                                 if (key==178) && (items_cur)
  103.                                 {
  104.                                         items_cur--;
  105.                                         goto _ITEMS_DRAW;
  106.                                 }
  107.                                 if (key==177) && (items_cur+1<items_num)
  108.                                 {
  109.                                         items_cur++;
  110.                                         goto _ITEMS_DRAW;
  111.                                 }
  112.                                 if (key==13)
  113.                                 {
  114.                                         ItemProcess(items_cur);
  115.                                 }
  116.                                 break;
  117.                                
  118.                 case evReDraw:
  119.                                 while (ITEMS_LIST[items_num*3]) items_num++;
  120.                                 m.get();
  121.                                 DefineAndDrawWindow(m.x+1,m.y,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,0x01,sc.work,0, 0x01fffFFF);
  122.                                 DrawRectangle(0,0,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,sc.work_graph); //îáîäîê
  123.                                
  124.                                 _ITEMS_DRAW:
  125.                                 for (i=0; i<items_num; i++;)
  126.                                 {
  127.                                         if (i==items_cur)
  128.                                         {
  129.                                                 DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, 1, sc.work_graph);
  130.                                                 DrawBar(1, i+1*ITEM_HEIGHT, ITEM_WIDTH-1, 1, 0xFFFfff);
  131.                                                 DrawBar(1, i*ITEM_HEIGHT+2, ITEM_WIDTH-1, ITEM_HEIGHT-2, sc.work_button);
  132.                                                 WriteText(8,i*ITEM_HEIGHT+6,0x80,sc.work_button_text,ITEMS_LIST[i*3],0);
  133.                                         }
  134.                                         else
  135.                                         {
  136.                                                 DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, sc.work);
  137.                                                 WriteText(8,i*ITEM_HEIGHT+6,0x80,sc.work_text,ITEMS_LIST[i*3],0);
  138.                                         }
  139.                                 }
  140.         }
  141. }
  142.  
  143. void ItemProcess(int num_id)
  144. {
  145.         RunProgram(ITEMS_LIST[num_id*3+1], ITEMS_LIST[num_id*3+2]);
  146.         ExitProcess();
  147. }
  148.  
  149. stop:
  150.