2018-09-14 20:07:55 +02:00
|
|
|
|
/*
|
|
|
|
|
* System Monitor
|
2020-05-10 03:44:40 +02:00
|
|
|
|
* version 1.0
|
2018-09-14 20:07:55 +02:00
|
|
|
|
* Author: Leency
|
|
|
|
|
*/
|
|
|
|
|
|
2019-03-18 23:31:13 +01:00
|
|
|
|
#define MEMSIZE 4096*30
|
|
|
|
|
|
|
|
|
|
//===================================================//
|
|
|
|
|
// //
|
|
|
|
|
// LIB //
|
|
|
|
|
// //
|
|
|
|
|
//===================================================//
|
2018-09-14 20:07:55 +02:00
|
|
|
|
|
|
|
|
|
#include "../lib/io.h"
|
|
|
|
|
#include "../lib/gui.h"
|
2018-09-15 12:48:42 +02:00
|
|
|
|
#include "../lib/fs.h"
|
2019-03-18 23:31:13 +01:00
|
|
|
|
#include "../lib/list_box.h"
|
2018-09-14 20:07:55 +02:00
|
|
|
|
|
|
|
|
|
#include "../lib/obj/libio.h"
|
|
|
|
|
#include "../lib/obj/libimg.h"
|
|
|
|
|
#include "../lib/obj/libini.h"
|
2019-03-18 23:31:13 +01:00
|
|
|
|
#include "../lib/obj/box_lib.h"
|
|
|
|
|
|
|
|
|
|
#include "../lib/patterns/select_list.h"
|
|
|
|
|
#include "../lib/patterns/restart_process.h"
|
2018-09-14 20:07:55 +02:00
|
|
|
|
|
|
|
|
|
//===================================================//
|
|
|
|
|
// //
|
|
|
|
|
// DATA //
|
|
|
|
|
// //
|
|
|
|
|
//===================================================//
|
|
|
|
|
|
2019-03-18 23:31:13 +01:00
|
|
|
|
#define WIN_PAD 20 //Window padding
|
|
|
|
|
#define WIN_CONTENT_X WIN_PAD
|
2020-05-10 03:44:40 +02:00
|
|
|
|
#define WIN_CONTENT_Y TAB_HEIGHT+WIN_PAD+20
|
2019-03-18 23:31:13 +01:00
|
|
|
|
#define WIN_CONTENT_W 400
|
|
|
|
|
#define WIN_CONTENT_H 465
|
2020-05-10 03:44:40 +02:00
|
|
|
|
#define ICONGAP 26
|
2019-03-18 23:31:13 +01:00
|
|
|
|
proc_info Form;
|
2018-09-14 20:07:55 +02:00
|
|
|
|
|
2020-05-10 03:44:40 +02:00
|
|
|
|
#ifdef LANG_RUS
|
|
|
|
|
#define T_CPU_AND_RAM "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD>"
|
|
|
|
|
#define T_DRIVES "<22><>᪨"
|
|
|
|
|
#define T_PROCESSES "<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
#define T_APP_TITLE "System Monitor"
|
|
|
|
|
#else
|
|
|
|
|
#define T_CPU_AND_RAM "CPU & RAM"
|
|
|
|
|
#define T_DRIVES "Drives"
|
2019-03-18 23:31:13 +01:00
|
|
|
|
#define T_PROCESSES "Processes"
|
2020-05-10 03:44:40 +02:00
|
|
|
|
#define T_APP_TITLE "System Monitor"
|
|
|
|
|
#endif
|
2018-09-15 12:48:42 +02:00
|
|
|
|
|
2019-03-18 23:31:13 +01:00
|
|
|
|
enum {
|
|
|
|
|
TAB_GENERAL=20,
|
2020-05-10 03:44:40 +02:00
|
|
|
|
TAB_DRIVES,
|
2019-03-18 23:31:13 +01:00
|
|
|
|
TAB_PROCESSES
|
|
|
|
|
};
|
2018-09-14 20:07:55 +02:00
|
|
|
|
|
2020-05-10 03:44:40 +02:00
|
|
|
|
_tabs tabs = { TAB_GENERAL, 4, 10, WIN_CONTENT_W+WIN_PAD+WIN_PAD-4-4, TAB_HEIGHT };
|
|
|
|
|
|
|
|
|
|
//===================================================//
|
|
|
|
|
// //
|
|
|
|
|
// GENERAL EVENTS //
|
|
|
|
|
// //
|
|
|
|
|
//===================================================//
|
2018-09-14 20:07:55 +02:00
|
|
|
|
|
2019-03-18 23:31:13 +01:00
|
|
|
|
int Sysmon__DefineAndDrawWindow()
|
2018-09-15 12:48:42 +02:00
|
|
|
|
{
|
2020-05-10 03:44:40 +02:00
|
|
|
|
dword butx;
|
2020-04-18 01:52:24 +02:00
|
|
|
|
sc.get();
|
2019-03-18 23:31:13 +01:00
|
|
|
|
DefineAndDrawWindow(screen.width - WIN_CONTENT_H - 200, 100, WIN_CONTENT_W + WIN_PAD + WIN_PAD +9,
|
2020-05-10 03:44:40 +02:00
|
|
|
|
WIN_CONTENT_H + TAB_HEIGHT + skin_height + 4, 0x34, sc.work, T_APP_TITLE,0);
|
2019-03-18 23:31:13 +01:00
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
|
if (Form.status_window>2) return false;
|
|
|
|
|
//if (Form.width < 300) { MoveSize(OLD,OLD,300,OLD); break; }
|
|
|
|
|
//if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); break; }
|
|
|
|
|
tabs.draw_wrapper();
|
2020-05-10 03:44:40 +02:00
|
|
|
|
butx = tabs.draw_button(tabs.x+TAB_PADDING, TAB_GENERAL, T_CPU_AND_RAM);
|
|
|
|
|
butx = tabs.draw_button(strlen(T_CPU_AND_RAM)*8+TAB_PADDING+butx, TAB_DRIVES, T_DRIVES);
|
|
|
|
|
tabs.draw_button(strlen(T_DRIVES)*8+TAB_PADDING+butx, TAB_PROCESSES, T_PROCESSES);
|
2019-03-18 23:31:13 +01:00
|
|
|
|
return true;
|
2018-09-15 12:48:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-10 03:44:40 +02:00
|
|
|
|
int Sysmon__ButtonEvent()
|
2018-09-14 20:07:55 +02:00
|
|
|
|
{
|
2020-05-10 03:44:40 +02:00
|
|
|
|
int bid = GetButtonID();
|
|
|
|
|
if (1==bid) ExitProcess();
|
|
|
|
|
if (TAB_GENERAL==bid) {
|
2019-03-18 23:31:13 +01:00
|
|
|
|
tabs.active_tab = TAB_GENERAL;
|
2020-05-10 03:44:40 +02:00
|
|
|
|
CPUnRAM__Main();
|
2018-09-14 20:07:55 +02:00
|
|
|
|
}
|
2020-05-10 03:44:40 +02:00
|
|
|
|
if (TAB_PROCESSES==bid) {
|
2019-03-18 23:31:13 +01:00
|
|
|
|
tabs.active_tab = TAB_PROCESSES;
|
|
|
|
|
Processes__Main();
|
2018-09-14 20:07:55 +02:00
|
|
|
|
}
|
2020-05-10 03:44:40 +02:00
|
|
|
|
if (TAB_DRIVES==bid) {
|
|
|
|
|
tabs.active_tab = TAB_DRIVES;
|
|
|
|
|
Drives__Main();
|
|
|
|
|
}
|
|
|
|
|
return bid;
|
2018-09-14 20:07:55 +02:00
|
|
|
|
}
|
2019-03-18 23:31:13 +01:00
|
|
|
|
|
2020-05-10 03:44:40 +02:00
|
|
|
|
void Sysmon__KeyEvent()
|
|
|
|
|
{
|
|
|
|
|
GetKeys();
|
|
|
|
|
if (key_scancode == SCAN_CODE_ESC) ExitProcess();
|
|
|
|
|
}
|
2019-03-18 23:31:13 +01:00
|
|
|
|
|
2020-05-10 03:44:40 +02:00
|
|
|
|
#include "cpu_ram.h"
|
|
|
|
|
#include "drives.h"
|
|
|
|
|
#include "process.h"
|
|
|
|
|
|
|
|
|
|
void main()
|
|
|
|
|
{
|
|
|
|
|
load_dll(libio, #libio_init,1);
|
|
|
|
|
load_dll(libimg, #libimg_init,1);
|
|
|
|
|
load_dll(libini, #lib_init,1);
|
|
|
|
|
load_dll(boxlib, #box_lib_init,0);
|
|
|
|
|
CPUnRAM__Main();
|
|
|
|
|
}
|