forked from KolibriOS/kolibrios
Sysmon: add a button to hide and show sensors (but it do not remember its state after app reopen)
git-svn-id: svn://kolibrios.org@9581 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
59d0c5206e
commit
512e7907ed
@ -135,6 +135,7 @@ void handle_param()
|
|||||||
strcpy(#program_path+strrchr(#program_path,'/'), "EOLITE");
|
strcpy(#program_path+strrchr(#program_path,'/'), "EOLITE");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SetAppColors();
|
||||||
LoadIniSettings();
|
LoadIniSettings();
|
||||||
|
|
||||||
for (i=0; i<PANES_COUNT; i++) {
|
for (i=0; i<PANES_COUNT; i++) {
|
||||||
@ -190,7 +191,6 @@ void main()
|
|||||||
load_dll(libini, #lib_init,1);
|
load_dll(libini, #lib_init,1);
|
||||||
load_dll(libimg, #libimg_init,1);
|
load_dll(libimg, #libimg_init,1);
|
||||||
|
|
||||||
SetAppColors();
|
|
||||||
handle_param();
|
handle_param();
|
||||||
|
|
||||||
SystemDiscs.Get();
|
SystemDiscs.Get();
|
||||||
|
@ -229,7 +229,8 @@ void SetAppColors()
|
|||||||
col.list_text_hidden = 0xA6A6B7;
|
col.list_text_hidden = 0xA6A6B7;
|
||||||
col.list_vert_line = 0xDDD7CF;
|
col.list_vert_line = 0xDDD7CF;
|
||||||
col.lpanel = 0x00699C;
|
col.lpanel = 0x00699C;
|
||||||
col.selec = col.selec_active = 0x92B1D9;
|
if (efm) EBX = 0x84BEFB; else EBX = 0x92B1D9;
|
||||||
|
col.selec = col.selec_active = EBX;
|
||||||
col.selec_text = 0x000000;
|
col.selec_text = 0x000000;
|
||||||
col.slider_bg_big = 0xCDCFCF;
|
col.slider_bg_big = 0xCDCFCF;
|
||||||
col.odd_line = 0xF4F5F5;
|
col.odd_line = 0xF4F5F5;
|
||||||
|
@ -2,4 +2,4 @@
|
|||||||
@c-- /D=LANG_RUS sysmon.c
|
@c-- /D=LANG_RUS sysmon.c
|
||||||
@rename sysmon.com sysmon
|
@rename sysmon.com sysmon
|
||||||
@del warning.txt
|
@del warning.txt
|
||||||
@pause
|
if not exist sysmon ( @pause )
|
@ -2,4 +2,4 @@
|
|||||||
@c-- /D=LANG_RUS sysmon.c
|
@c-- /D=LANG_RUS sysmon.c
|
||||||
@rename sysmon.com sysmon
|
@rename sysmon.com sysmon
|
||||||
@del warning.txt
|
@del warning.txt
|
||||||
@pause
|
if not exist sysmon ( @pause )
|
@ -1,10 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* System Monitor
|
* System Monitor
|
||||||
* version 1.37
|
* version 1.4
|
||||||
* Author: Leency
|
* Author: Leency
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define MEMSIZE 4096*30
|
#define MEMSIZE 1024*60
|
||||||
#define NO_DLL_INIT
|
#define NO_DLL_INIT
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
@ -61,10 +61,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
BTN_ID_SHOW_SYSTEM_PROCESSES=200,
|
BTN_SHOW_SYSTEM_PROCESSES=200,
|
||||||
BTN_ID_PROC_KILL,
|
BTN_PROC_KILL,
|
||||||
BTN_ID_PROC_INFO,
|
BTN_PROC_INFO,
|
||||||
BTN_ID_MENU
|
BTN_MENU,
|
||||||
|
BTN_SHOWHIDE_SENSORS
|
||||||
};
|
};
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
@ -87,21 +88,18 @@ proc_info Form;
|
|||||||
|
|
||||||
int right_w;
|
int right_w;
|
||||||
|
|
||||||
|
bool show_sensors = true;
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
// //
|
// //
|
||||||
// CODE //
|
// CODE //
|
||||||
// //
|
// //
|
||||||
//===================================================//
|
//===================================================//
|
||||||
|
|
||||||
void load_lib()
|
|
||||||
{
|
|
||||||
load_dll(boxlib, #box_lib_init,0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
int btn;
|
int btn;
|
||||||
load_lib();
|
load_dll(boxlib, #box_lib_init,0);
|
||||||
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
|
@SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER);
|
||||||
loop() switch(@WaitEventTimeout(50))
|
loop() switch(@WaitEventTimeout(50))
|
||||||
{
|
{
|
||||||
@ -121,27 +119,45 @@ void main()
|
|||||||
if (show_system.click(btn)) {
|
if (show_system.click(btn)) {
|
||||||
SelectList_LineChanged();
|
SelectList_LineChanged();
|
||||||
}
|
}
|
||||||
if (BTN_ID_PROC_KILL == btn) {
|
if (BTN_PROC_KILL == btn) {
|
||||||
EventKillCurrentProcess();
|
EventKillCurrentProcess();
|
||||||
}
|
}
|
||||||
if (BTN_ID_PROC_INFO == btn) {
|
if (BTN_PROC_INFO == btn) {
|
||||||
RunProgram("/sys/tinfo", itoa(GetProcessSlot(current_process_id)));
|
RunProgram("/sys/tinfo", itoa(GetProcessSlot(current_process_id)));
|
||||||
}
|
}
|
||||||
|
if (BTN_SHOWHIDE_SENSORS == btn) {
|
||||||
|
show_sensors ^= 1;
|
||||||
|
GOTO _DRAW_WINDOW;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
sc.get();
|
sc.get();
|
||||||
DefineAndDrawWindow(screen.width/2 - 350, 100, 700, 490, 0x33, sc.work, T_APP_TITLE,0);
|
DefineAndDrawWindow(screen.width/2 - 350, 100, 700, 490, 0x33, sc.work, T_APP_TITLE,0);
|
||||||
|
_DRAW_WINDOW:
|
||||||
GetProcessInfo(#Form, SelfInfo);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
if (Form.status_window&ROLLED_UP) break;
|
if (Form.status_window&ROLLED_UP) break;
|
||||||
if (Form.width < RIGHT_X+370) { MoveSize(OLD,OLD,RIGHT_X+370,OLD); break; }
|
|
||||||
if (Form.height < 420) { MoveSize(OLD,OLD,OLD,420); break; }
|
if (Form.height < 420) { MoveSize(OLD,OLD,OLD,420); break; }
|
||||||
|
if (show_sensors) {
|
||||||
|
if (Form.width < RIGHT_X+370) { MoveSize(OLD,OLD,RIGHT_X+370,OLD); break; }
|
||||||
|
} else {
|
||||||
|
if (Form.width != RIGHT_X+5) { MoveSize(OLD,OLD,RIGHT_X+5,OLD); break; }
|
||||||
|
}
|
||||||
right_w = Form.cwidth - RIGHT_X - GAP;
|
right_w = Form.cwidth - RIGHT_X - GAP;
|
||||||
right_w &= ~1; // make sure the number is even
|
right_w &= ~1; // make sure the number is even
|
||||||
WriteText(GAP+5, WIN_CONTENT_Y-20, 0x90, sc.work_text, T_PROC_HEADER);
|
WriteText(GAP+5, WIN_CONTENT_Y-20, 0x90, sc.work_text, T_PROC_HEADER);
|
||||||
|
|
||||||
|
DefineButton(RIGHT_X-38,WIN_CONTENT_Y-25,18,18,BTN_SHOWHIDE_SENSORS,sc.work);
|
||||||
|
DrawRectangle3D(RIGHT_X-38,WIN_CONTENT_Y-25,19,18,sc.work_graph,sc.work_light);
|
||||||
|
PutPixel(RIGHT_X-38+19,WIN_CONTENT_Y-25,sc.work_light);
|
||||||
|
EDX = "<\0>";
|
||||||
|
EDX += show_sensors * 2;
|
||||||
|
WriteText(RIGHT_X-38+5,WIN_CONTENT_Y-25+2,0x90,sc.work_text, EDX);
|
||||||
|
//EBX += 5 << 16;
|
||||||
|
//$int 64
|
||||||
|
|
||||||
//bool burger_active = false;
|
//bool burger_active = false;
|
||||||
//if (menu_id == OPEN_FILE) burger_active = true;
|
//if (menu_id == OPEN_FILE) burger_active = true;
|
||||||
//DrawTopPanelButton(BTN_ID_MENU, Form.cwidth-GAP-3, GAP, -1, burger_active);
|
//DrawTopPanelButton(BTN_MENU, Form.cwidth-GAP-3, GAP, -1, burger_active);
|
||||||
|
|
||||||
SelectList_Init(GAP, WIN_CONTENT_Y, PROCESS_LIST_W,
|
SelectList_Init(GAP, WIN_CONTENT_Y, PROCESS_LIST_W,
|
||||||
Form.cheight-BOTPANEL_H-WIN_CONTENT_Y);
|
Form.cheight-BOTPANEL_H-WIN_CONTENT_Y);
|
||||||
@ -150,22 +166,26 @@ void main()
|
|||||||
DrawBar(select_list.x-2, select_list.y+select_list.h+2,
|
DrawBar(select_list.x-2, select_list.y+select_list.h+2,
|
||||||
select_list.w+scroll1.size_x+4, BOTPANEL_H, sc.work);
|
select_list.w+scroll1.size_x+4, BOTPANEL_H, sc.work);
|
||||||
DrawCaptButton(PROCESS_LIST_W+GAP-110+18, select_list.y+select_list.h+5,
|
DrawCaptButton(PROCESS_LIST_W+GAP-110+18, select_list.y+select_list.h+5,
|
||||||
110,23,BTN_ID_PROC_KILL,0xF38181, 0xFFFfff, T_PROC_KILL);
|
110,23,BTN_PROC_KILL,0xF38181, 0xFFFfff, T_PROC_KILL);
|
||||||
DrawCaptButton(PROCESS_LIST_W+GAP-165+18, select_list.y+select_list.h+5,
|
DrawCaptButton(PROCESS_LIST_W+GAP-165+18, select_list.y+select_list.h+5,
|
||||||
46,23,BTN_ID_PROC_INFO,sc.button, sc.button_text, T_PROC_INFO);
|
46,23,BTN_PROC_INFO,sc.button, sc.button_text, T_PROC_INFO);
|
||||||
show_system.draw(GAP-1, select_list.y+select_list.h+10);
|
show_system.draw(GAP-1, select_list.y+select_list.h+10);
|
||||||
|
|
||||||
//WriteText(RIGHT_X, WIN_CONTENT_Y+25, 0x90, sc.work, "Update period: 5 seconds");
|
//WriteText(RIGHT_X, WIN_CONTENT_Y+25, 0x90, sc.work, "Update period: 5 seconds");
|
||||||
|
if (show_sensors) {
|
||||||
cpu.set_size(RIGHT_X, WIN_CONTENT_Y+25, right_w, 100);
|
cpu.set_size(RIGHT_X, WIN_CONTENT_Y+25, right_w, 100);
|
||||||
ram.set_size(RIGHT_X, WIN_CONTENT_Y+170, right_w, 23);
|
ram.set_size(RIGHT_X, WIN_CONTENT_Y+170, right_w, 23);
|
||||||
rd.set_size(RIGHT_X, WIN_CONTENT_Y+240, right_w, 23);
|
rd.set_size(RIGHT_X, WIN_CONTENT_Y+240, right_w, 23);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
|
SelectList_LineChanged();
|
||||||
|
if (show_sensors) {
|
||||||
MonitorCpu();
|
MonitorCpu();
|
||||||
MonitorRam();
|
MonitorRam();
|
||||||
SelectList_LineChanged();
|
|
||||||
MonitorRd();
|
MonitorRd();
|
||||||
MonitorTmp();
|
MonitorTmp();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventKillCurrentProcess()
|
void EventKillCurrentProcess()
|
||||||
|
Loading…
Reference in New Issue
Block a user