Subversion Repositories Kolibri OS

Rev

Rev 7906 | Rev 8277 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * System Monitor
  3.  * version 1.0
  4.  * Author: Leency
  5. */
  6.  
  7. #define MEMSIZE 4096*30
  8.  
  9. //===================================================//
  10. //                                                   //
  11. //                       LIB                         //
  12. //                                                   //
  13. //===================================================//
  14.  
  15. #include "../lib/io.h"
  16. #include "../lib/gui.h"
  17. #include "../lib/fs.h"
  18. #include "../lib/list_box.h"
  19.  
  20. #include "../lib/obj/libio.h"
  21. #include "../lib/obj/libimg.h"
  22. #include "../lib/obj/libini.h"
  23. #include "../lib/obj/box_lib.h"
  24.  
  25. #include "../lib/patterns/select_list.h"
  26. #include "../lib/patterns/restart_process.h"
  27.  
  28. //===================================================//
  29. //                                                   //
  30. //                       DATA                        //
  31. //                                                   //
  32. //===================================================//
  33.  
  34. #define WIN_PAD 20   //Window padding
  35. #define WIN_CONTENT_X WIN_PAD
  36. #define WIN_CONTENT_Y TAB_HEIGHT+WIN_PAD+20
  37. #define WIN_CONTENT_W 400
  38. #define WIN_CONTENT_H 465
  39. #define ICONGAP 26
  40. #define BASE_TAB_BUTTON_ID 10
  41. proc_info Form;
  42.  
  43. #ifdef LANG_RUS
  44. #define T_CPU_AND_RAM   "à®æ¥áá®à ¨ Ž‡“"
  45. #define T_DRIVES     "„¨áª¨"
  46. #define T_PROCESSES "à®æ¥ááë"
  47. #define T_APP_TITLE "System Monitor"
  48. #else
  49. #define T_CPU_AND_RAM   "CPU & RAM"
  50. #define T_DRIVES     "Drives"
  51. #define T_PROCESSES "Processes"
  52. #define T_APP_TITLE "System Monitor"
  53. #endif
  54.  
  55. _tabs tabs = { 4, 10, WIN_CONTENT_W+WIN_PAD+WIN_PAD-4-4, BASE_TAB_BUTTON_ID };
  56.  
  57. //===================================================//
  58. //                                                   //
  59. //                 GENERAL  EVENTS                   //
  60. //                                                   //
  61. //===================================================//
  62.  
  63. int Sysmon__DefineAndDrawWindow()
  64. {
  65.         dword butx;
  66.         sc.get();
  67.         DefineAndDrawWindow(screen.width - WIN_CONTENT_H - 200, 100, WIN_CONTENT_W + WIN_PAD + WIN_PAD +9,
  68.                 WIN_CONTENT_H + TAB_HEIGHT + skin_height + 4, 0x34, sc.work, T_APP_TITLE,0);
  69.         GetProcessInfo(#Form, SelfInfo);
  70.         if (Form.status_window>2) return false;
  71.         //if (Form.width  < 300) { MoveSize(OLD,OLD,300,OLD); break; }
  72.         //if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); break; }
  73.         tabs.draw();
  74.         return true;
  75. }
  76.  
  77. int Sysmon__ButtonEvent()
  78. {
  79.         int bid = GetButtonID();
  80.         if (1==bid) ExitProcess();
  81.         tabs.click();
  82.         return bid;
  83. }
  84.  
  85. void Sysmon__KeyEvent()
  86. {
  87.         GetKeys();
  88.         if (key_scancode == SCAN_CODE_ESC) ExitProcess();
  89. }
  90.  
  91. #include "cpu_ram.h"
  92. #include "drives.h"
  93. #include "process.h"
  94.  
  95. void main()
  96. {
  97.         load_dll(libio, #libio_init,1);
  98.         load_dll(libimg, #libimg_init,1);
  99.         load_dll(libini, #lib_init,1);
  100.         load_dll(boxlib, #box_lib_init,0);
  101.  
  102.         tabs.add(T_CPU_AND_RAM, #CPUnRAM__Main);
  103.         tabs.add(T_DRIVES,      #Drives__Main);
  104.         tabs.add(T_PROCESSES,   #Processes__Main);
  105.  
  106.         CPUnRAM__Main();
  107. }