Subversion Repositories Kolibri OS

Rev

Rev 7906 | Rev 8277 | 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
7909 leency 40
#define BASE_TAB_BUTTON_ID 10
7614 leency 41
proc_info Form;
7361 leency 42
 
7906 leency 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"
7614 leency 51
#define T_PROCESSES "Processes"
7906 leency 52
#define T_APP_TITLE "System Monitor"
53
#endif
7369 leency 54
 
7909 leency 55
_tabs tabs = { 4, 10, WIN_CONTENT_W+WIN_PAD+WIN_PAD-4-4, BASE_TAB_BUTTON_ID };
7361 leency 56
 
7906 leency 57
//===================================================//
58
//                                                   //
59
//                 GENERAL  EVENTS                   //
60
//                                                   //
61
//===================================================//
62
 
7614 leency 63
int Sysmon__DefineAndDrawWindow()
7369 leency 64
{
7906 leency 65
	dword butx;
7806 leency 66
	sc.get();
7614 leency 67
	DefineAndDrawWindow(screen.width - WIN_CONTENT_H - 200, 100, WIN_CONTENT_W + WIN_PAD + WIN_PAD +9,
7906 leency 68
		WIN_CONTENT_H + TAB_HEIGHT + skin_height + 4, 0x34, sc.work, T_APP_TITLE,0);
7614 leency 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; }
7909 leency 73
	tabs.draw();
7614 leency 74
	return true;
7369 leency 75
}
76
 
7906 leency 77
int Sysmon__ButtonEvent()
7361 leency 78
{
7906 leency 79
	int bid = GetButtonID();
80
	if (1==bid) ExitProcess();
7909 leency 81
	tabs.click();
7906 leency 82
	return bid;
7361 leency 83
}
7614 leency 84
 
7906 leency 85
void Sysmon__KeyEvent()
86
{
87
	GetKeys();
88
	if (key_scancode == SCAN_CODE_ESC) ExitProcess();
89
}
7614 leency 90
 
7906 leency 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);
7909 leency 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
 
7906 leency 106
	CPUnRAM__Main();
107
}