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