Subversion Repositories Kolibri OS

Rev

Rev 7806 | Rev 7909 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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