Subversion Repositories Kolibri OS

Rev

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

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