Subversion Repositories Kolibri OS

Rev

Rev 3410 | 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.                                 m.get();
  84.  
  85.                                 id1=GetProcessSlot(MenuForm.ID);
  86.                                 if (id1<>GetActiveProcess()) ExitProcess();
  87.                                 id1=m.y-1/ITEM_HEIGHT;
  88.                                 if (m.y<0) || (id1+1>items_num) || (m.x<0) || (m.x>ITEM_WIDTH) break;
  89.                                 if (m.lkm) || (m.pkm)
  90.                                 {
  91.                                         //feel clicking
  92.                                         DrawBar(1, items_cur*ITEM_HEIGHT+2, ITEM_WIDTH-1, ITEM_HEIGHT-2, sc.work_graph);
  93.                                         WriteText(8,items_cur*ITEM_HEIGHT+6,0x80,sc.work_button_text,ITEMS_LIST[items_cur*3]);
  94.                                         pause(4);
  95.                                        
  96.                                         ItemProcess(items_cur);
  97.                                 }
  98.                                 if (items_cur<>id1)
  99.                                 {
  100.                                         items_cur=id1;
  101.                                         goto _ITEMS_DRAW;
  102.                                 }
  103.                                
  104.                                 break;
  105.                                
  106.                 case evButton:
  107.                                 break;
  108.                                
  109.                 case evKey:
  110.                                 key = GetKey();
  111.                                 if (key==27) ExitProcess();
  112.                                 if (key==178) && (items_cur)
  113.                                 {
  114.                                         items_cur--;
  115.                                         goto _ITEMS_DRAW;
  116.                                 }
  117.                                 if (key==177) && (items_cur+1<items_num)
  118.                                 {
  119.                                         items_cur++;
  120.                                         goto _ITEMS_DRAW;
  121.                                 }
  122.                                 if (key==13)
  123.                                 {
  124.                                         ItemProcess(items_cur);
  125.                                 }
  126.                                 break;
  127.                                
  128.                 case evReDraw:
  129.                                 while (ITEMS_LIST[items_num*3]) items_num++;
  130.                                 m.get();
  131.                                 DefineAndDrawWindow(m.x+1,m.y,ITEM_WIDTH+1,items_num*ITEM_HEIGHT+2,0x01,sc.work,0, 0x01fffFFF);
  132.                                 GetProcessInfo(#MenuForm, SelfInfo);
  133.                                 DrawRectangle(0,0,ITEM_WIDTH,items_num*ITEM_HEIGHT+1,sc.work_graph); //îáîäîê
  134.                                 PutShadow(ITEM_WIDTH+1,1,1,items_num*ITEM_HEIGHT+1,0,1);
  135.                                 PutShadow(1,items_num*ITEM_HEIGHT+2,ITEM_WIDTH+1,1,0,1);
  136.                                
  137.                                 _ITEMS_DRAW:
  138.                                 for (i=0; i<items_num; i++;)
  139.                                 {
  140.                                         if (i==items_cur)
  141.                                         {
  142.                                                 DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, 1, sc.work_graph);
  143.                                                 DrawBar(1, i+1*ITEM_HEIGHT, ITEM_WIDTH-1, 1, 0xFFFfff);
  144.                                                 DrawBar(1, i*ITEM_HEIGHT+2, ITEM_WIDTH-1, ITEM_HEIGHT-2, sc.work_button);
  145.                                                 WriteText(8,i*ITEM_HEIGHT+6,0x80,sc.work_button_text,ITEMS_LIST[i*3]);
  146.                                         }
  147.                                         else
  148.                                         {
  149.                                                 DrawBar(1, i*ITEM_HEIGHT+1, ITEM_WIDTH-1, ITEM_HEIGHT, sc.work);
  150.                                                 WriteText(8,i*ITEM_HEIGHT+6,0x80,sc.work_text,ITEMS_LIST[i*3]);
  151.                                         }
  152.                                 }
  153.         }
  154. }
  155.  
  156.  
  157. void ItemProcess(int num_id)
  158. {
  159.         RunProgram(ITEMS_LIST[num_id*3+1], ITEMS_LIST[num_id*3+2]);
  160.         ExitProcess();
  161. }
  162.  
  163. stop:
  164.