diff --git a/data/common/File Managers/icons.ini b/data/common/File Managers/icons.ini index 57cacda11e..55fbd70423 100644 --- a/data/common/File Managers/icons.ini +++ b/data/common/File Managers/icons.ini @@ -142,7 +142,7 @@ lif=14 3ds=15 asc=15 vox=15 -tls=15 +stl=15 kex=16 skn=17 obj=18 @@ -225,4 +225,4 @@ djvu=85 csv=28 rft=85 lif=13 -tls=78 \ No newline at end of file +stl=78 \ No newline at end of file diff --git a/programs/cmm/app_plus/app_plus.c b/programs/cmm/app_plus/app_plus.c index b84ac43195..1ca20c579f 100644 --- a/programs/cmm/app_plus/app_plus.c +++ b/programs/cmm/app_plus/app_plus.c @@ -153,7 +153,9 @@ void EventManualSearch() void EventOpenApp() { - RunProgram("syspanel", APP_PLUS_INI_PATH); + if (RunProgram("/sys/syspanel", APP_PLUS_INI_PATH) < 0) { + notify("'App+ can not be started because\n/sys/syspanel does not exists' -E"); + } } void EventButton(dword id) diff --git a/programs/cmm/appearance/appearance.c b/programs/cmm/appearance/appearance.c index c3fc0e27fc..9041ac328b 100644 --- a/programs/cmm/appearance/appearance.c +++ b/programs/cmm/appearance/appearance.c @@ -19,6 +19,8 @@ #include "..\lib\patterns\select_list.h" #include "..\lib\patterns\simple_open_dialog.h" +#include "ui_elements_preview.h" + //===================================================// // // // DATA // @@ -69,17 +71,9 @@ int cur; proc_info Form; block skp; -_tabs tabs = { LP, LP, NULL, NULL, SKINS }; +_tabs tabs = { SKINS, LP, LP, NULL, NULL }; checkbox update_docky = { T_UPDATE_DOCK, false }; -checkbox checkbox1 = { "Checkbox", true }; -more_less_box spinbox1 = { 23, 0, 999, "SpinBox" }; -edit_box edit_cmm = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff, - 0x10000000,sizeof(param)-2,#param,0, 0b}; - -char st_str[16]; -edit_box edit_st = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff, - 0x10000000,sizeof(st_str)-2,#st_str,0, 0b}; char default_dir[] = "/rd/1"; od_filter filter2 = { 8, "TXT\0\0" }; @@ -191,7 +185,8 @@ void main() void draw_window() { - DefineAndDrawWindow(screen.width-600/2,80,630,504+skin_height,0x74,NULL,WINDOW_HEADER,0); + system.color.get(); + DefineAndDrawWindow(screen.width-600/2,80,630,504+skin_height,0x34,system.color.work,WINDOW_HEADER,0); GetProcessInfo(#Form, SelfInfo); IF (Form.status_window>=2) return; DrawWindowContent(); @@ -200,19 +195,15 @@ void draw_window() void DrawWindowContent() { int id; - incn y; int list_w; system.color.get(); if (tabs.active_tab == SKINS) list_w=250; else list_w=350; - DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, system.color.work); - tabs.w = Form.cwidth-LP-LP; tabs.h = Form.cheight-LP-LP; tabs.draw_wrapper(); - tabs.draw_button(tabs.x+TAB_PADDING, SKINS, T_SKINS); tabs.draw_button(strlen(T_SKINS)*8+tabs.x+TAB_PADDING+TAB_PADDING, WALLPAPERS, T_WALLPAPERS); @@ -235,46 +226,24 @@ void DrawWindowContent() SelectList_Draw(); SelectList_DrawBorder(); + //DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, LP, system.color.work); if (tabs.active_tab == SKINS) { - DrawBar(skp.x-20, select_list.y, skp.w+40, select_list.h, system.color.work); - DrawRectangle(skp.x-20, select_list.y, skp.w+40, select_list.h, system.color.work_graph); update_docky.draw(skp.x, select_list.y+15); - y.n = skp.y; DrawFrame(skp.x, skp.y, skp.w, skp.h, " Components Preview "); - spinbox1.draw(skp.x+20, y.inc(30)); - WriteText(skp.x+20, y.inc(30), 0x90, system.color.work_text, "C-- Edit"); - DrawEditBoxPos(skp.x+20, y.inc(20), #edit_cmm); - WriteText(skp.x+20, y.inc(35), 0x90, system.color.work_text, "Strandard Edit"); - DrawStEditBoxPos(skp.x+20, y.inc(20), #edit_st); - DrawStandartCaptButton(skp.x+20, skp.y+skp.h-40, GetFreeButtonId(), "Button1"); - DrawStandartCaptButton(skp.x+120, skp.y+skp.h-40, GetFreeButtonId(), "Button2"); + DrawUiElementsPreview(skp.x+20, skp.y, skp.h); } if (tabs.active_tab == WALLPAPERS) { skp.x -= TAB_PADDING + 3; DrawStandartCaptButton(skp.x, select_list.y, BTN_SELECT_WALLP_FOLDER, T_SELECT_FOLDER); - DrawBar(skp.x, select_list.y+50, 180, 80, system.color.work); DrawFrame(skp.x, select_list.y+50, 180, 80, T_PICTURE_MODE); optionbox_stretch.draw(skp.x+14, select_list.y+70); optionbox_tiled.draw(skp.x+14, select_list.y+97); } } -:void DrawStEditBoxPos(dword x,y, edit_box_pointer) -{ - dword c_inactive = MixColors(system.color.work_graph, system.color.work, 128); - dword c_active = MixColors(system.color.work_graph, 0, 128); - ESI = edit_box_pointer; - ESI.edit_box.left = x; - ESI.edit_box.top = y; - ESI.edit_box.blur_border_color = c_inactive; - ESI.edit_box.focus_border_color = c_active; - edit_box_draw stdcall (edit_box_pointer); -} - - void Open_Dir() { @@ -356,7 +325,7 @@ void EventTabClick(int N) select_list.cur_y = active_wallpaper; } if (select_list.cur_y>select_list.visible) select_list.first=select_list.cur_y; select_list.CheckDoesValuesOkey(); - if (select_list.w) DrawWindowContent(); + if (select_list.w) draw_window(); } void EventDeleteFile() diff --git a/programs/cmm/appearance/ui_elements_preview.h b/programs/cmm/appearance/ui_elements_preview.h new file mode 100644 index 0000000000..5738d0f1ff --- /dev/null +++ b/programs/cmm/appearance/ui_elements_preview.h @@ -0,0 +1,34 @@ + +checkbox checkbox1 = { "Checkbox", true }; +more_less_box spinbox1 = { 23, 0, 999, "SpinBox" }; +edit_box edit_cmm = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff, + 0x10000000,sizeof(param)-2,#param,0, 0b}; +char st_str[16]; +edit_box edit_st = {180,NULL,NULL,0xffffff,0x94AECE,0xFFFfff,0xffffff, + 0x10000000,sizeof(st_str)-2,#st_str,0, 0b}; + + +void DrawUiElementsPreview(dword x,y,h) +{ + incn y2; + y2.n = y; + spinbox1.draw(x, y2.inc(30)); + WriteText(x, y2.inc(30), 0x90, system.color.work_text, "C-- Edit"); + DrawEditBoxPos(x, y2.inc(20), #edit_cmm); + WriteText(x, y2.inc(35), 0x90, system.color.work_text, "Strandard Edit"); + DrawStEditBoxPos(x, y2.inc(20), #edit_st); + DrawStandartCaptButton(x, y+h-40, GetFreeButtonId(), "Button1"); + DrawStandartCaptButton(x+100, y+h-40, GetFreeButtonId(), "Button2"); +} + +:void DrawStEditBoxPos(dword x,y, edit_box_pointer) +{ + dword c_inactive = MixColors(system.color.work_graph, system.color.work, 128); + dword c_active = MixColors(system.color.work_graph, 0, 128); + ESI = edit_box_pointer; + ESI.edit_box.left = x; + ESI.edit_box.top = y; + ESI.edit_box.blur_border_color = c_inactive; + ESI.edit_box.focus_border_color = c_active; + edit_box_draw stdcall (edit_box_pointer); +} \ No newline at end of file diff --git a/programs/cmm/kf_font_viewer/compile_en.bat b/programs/cmm/kf_font_viewer/compile_en.bat index 38a9b64a72..f98f965141 100644 --- a/programs/cmm/kf_font_viewer/compile_en.bat +++ b/programs/cmm/kf_font_viewer/compile_en.bat @@ -1,5 +1,5 @@ +@del "kf_view" @C-- "font_viewer.c" -@del "font_viewer" -@rename "font_viewer.com" "font_viewer" +@rename "font_viewer.com" "kf_view" @del warning.txt @pause \ No newline at end of file diff --git a/programs/cmm/kf_font_viewer/font_viewer.c b/programs/cmm/kf_font_viewer/font_viewer.c index 466986e654..14a0d6f9fa 100644 --- a/programs/cmm/kf_font_viewer/font_viewer.c +++ b/programs/cmm/kf_font_viewer/font_viewer.c @@ -12,7 +12,7 @@ enum { PHRASE_TAB=20, CHARS_TAB }; -_tabs tabs = { 0,0, WIN_W, WIN_H, PHRASE_TAB}; +_tabs tabs = { PHRASE_TAB }; block preview = { 0, PANELH, WIN_W, WIN_H - PANELH }; checkbox bold = { "Bold", false }; diff --git a/programs/cmm/lib/gui/tabs.h b/programs/cmm/lib/gui/tabs.h index a6c22562bb..a5c30bcb8a 100644 --- a/programs/cmm/lib/gui/tabs.h +++ b/programs/cmm/lib/gui/tabs.h @@ -4,9 +4,8 @@ :struct _tabs { - int x,y,w,h; int active_tab; - int c; + int x,y,w,h; void draw_button(); int click(); void draw_wrapper(); @@ -14,20 +13,8 @@ :void _tabs::draw_wrapper() { - dword color_light = MixColors(system.color.work, 0xFFFfff, 40); - dword color_content = MixColors(system.color.work, 0xFFFfff, 120); - dword color_light_border = MixColors(system.color.work, system.color.work_graph, 120); - - DrawRectangle(x-1, y-1, w+1, h+1, system.color.work_graph); - DrawBar(x, y, w, h, color_content); //0xF3F3F3 - DrawRectangle3D(x, y, w-1, h-1, color_light, color_content); //0xF3F3F3 - - DrawBar(x+1, y+h+1, w-2, 2, system.color.work_dark); //"shadow" - - DrawBar(x, y+TAB_HEIGHT-1, w, 1, color_light_border); - DrawBar(x, y+TAB_HEIGHT, w, 1, color_light); - - c = y + TAB_HEIGHT; + DrawRectangle(x,y+TAB_HEIGHT,w-1,h-TAB_HEIGHT, system.color.work_graph); + DrawRectangle(x+1,y+1+TAB_HEIGHT,w-3,h-2-TAB_HEIGHT, system.color.work_light); } :void _tabs::draw_button(dword xx, but_id, text) @@ -38,16 +25,17 @@ if (but_id==active_tab) { col_bg=0xE44C9C; - col_text=0x000000; + col_text=system.color.work_text; } else { col_bg=0xC3A1B7; - col_text=0x333333; + col_text= MixColors(system.color.work, system.color.work_text, 120); } - DefineHiddenButton(xx,y, ww-1,hh-1, but_id); + DefineHiddenButton(xx-2,y, ww-1+4,hh-1, but_id); WriteText(xx, y+6, 0x90, col_text, text); DrawBar(xx, y+hh-3, ww, 3, col_bg); + //DrawStandartCaptButton(xx, y, but_id, text); //GetFreeButtonId() } :int _tabs::click(int N) diff --git a/programs/cmm/liza/mail_box.c b/programs/cmm/liza/mail_box.c index 2ccef1fbd5..ffde699382 100644 --- a/programs/cmm/liza/mail_box.c +++ b/programs/cmm/liza/mail_box.c @@ -217,7 +217,7 @@ void MailBoxLoop() { if (!mailstart) break; CreateFile(strlen(mailstart), mailstart, "mail.txt"); pause(10); - RunProgram("tinypad", "mail.txt"); + RunProgram("/sys/tinypad", "mail.txt"); } if (id==STOP_LOADING) { diff --git a/programs/cmm/process/Tupfile.lua b/programs/cmm/process/Tupfile.lua deleted file mode 100644 index 5bb9f28096..0000000000 --- a/programs/cmm/process/Tupfile.lua +++ /dev/null @@ -1,6 +0,0 @@ -if tup.getconfig("NO_CMM") ~= "" then return end -if tup.getconfig("LANG") == "ru" -then C_LANG = "LANG_RUS" -else C_LANG = "LANG_ENG" -- this includes default case without config -end -tup.rule("process.c", "c-- /D=AUTOBUILD /D=$(C_LANG) %f" .. tup.getconfig("KPACK_CMD"), "process.com") diff --git a/programs/cmm/process/compile.bat b/programs/cmm/process/compile.bat deleted file mode 100644 index d37e52e7c2..0000000000 --- a/programs/cmm/process/compile.bat +++ /dev/null @@ -1,9 +0,0 @@ -@del lang.h-- -@echo #define LANG_RUS 1 >lang.h-- - -C-- process.c -@del process -@rename process.com process -@pause -@del lang.h-- -@del warning.txt \ No newline at end of file diff --git a/programs/cmm/sysmon/general.h b/programs/cmm/sysmon/general.h new file mode 100644 index 0000000000..346ccdff0b --- /dev/null +++ b/programs/cmm/sysmon/general.h @@ -0,0 +1,185 @@ +//===================================================// +// // +// DATA // +// // +//===================================================// + +dword cpu_stack[1980*3]; + +sensor cpu; +sensor ram; +sensor rd; +sensor tmp[10]; + +dword tmp_size[10]; + +//===================================================// +// // +// CODE // +// // +//===================================================// + +void General__Main() +{ + dword cpu_frequency; + incn y; + SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON); + + cpu_frequency = GetCpuFrequency()/1000; + GetTmpDiskSizes(); + + goto _GENERAL_REDRAW; + + loop() + { + WaitEventTimeout(25); + switch(EAX & 0xFF) + { + case evButton: + Sysmon__ButtonEvent(GetButtonID()); + break; + + case evKey: + GetKeys(); + if (key_scancode == SCAN_CODE_ESC) ExitProcess(); + break; + + case evReDraw: + _GENERAL_REDRAW: + if (!Sysmon__DefineAndDrawWindow()) break; + + y.n = WIN_CONTENT_Y; + if (cpu_frequency < 1000) sprintf(#param, "CPU frequency: %i Hz", cpu_frequency); + else sprintf(#param, "CPU frequency: %i MHz", cpu_frequency/1000); + DrawBlockHeader(WIN_PAD, y.inc(0), 37, "CPU load", #param); + cpu.set_size(WIN_PAD, y.inc(45), WIN_CONTENT_W, 100); + + sprintf(#param, "Total RAM: %i MiB", GetTotalRAM()/1024); + DrawBlockHeader(WIN_PAD, y.inc(cpu.h + 25), 36, "RAM usage", #param); + ram.set_size(WIN_PAD, y.inc(45), WIN_CONTENT_W, 23); + + DrawBlockHeader(WIN_PAD, y.inc(ram.h + 25), 3, "System RAM Disk usage", "Fixed size: 1.44 MiB"); + rd.set_size(WIN_PAD, y.inc(45), WIN_CONTENT_W, 23); + + sprintf(#param, "TMP Disk 0 size: %i MiB", tmp_size[0]); + DrawBlockHeader(WIN_PAD, y.inc(rd.h + 25), 50, "Virtual drive usage", #param); + tmp[0].set_size(WIN_PAD, y.inc(45), WIN_CONTENT_W, 23); + + default: + MonitorCpu(); + + //MonitorRam(); + ram.draw_progress( + GetFreeRAM()*ram.w/GetTotalRAM(), + GetTotalRAM()-GetFreeRAM()/1024, + GetFreeRAM()/1024, + "M" + ); + DrawBar(ram.x+ram.w-96, ram.y-25, 96, 20, system.color.work); + sprintf(#param, "%i KiB", GetTotalRAM()-GetFreeRAM()); + WriteText(ram.x+ram.w-calc(strlen(#param)*8), ram.y-25, 0x90, system.color.work_text, #param); + + //MonitorRd(); + dir_size.get("/rd/1"); + dir_size.bytes += dir_size.files/2 + 32 * 512; //file attr size + FAT table size + dir_size.bytes /= 1024; //convert to KiB + dir_size.bytes = 1440 - dir_size.bytes; + rd.draw_progress( + dir_size.bytes*rd.w/1440, + 1440 - dir_size.bytes, + dir_size.bytes, + "K" + ); + + //MonitorTmp(); + if (tmp_size[0]) { + dir_size.get("/tmp0/1"); + dir_size.bytes += dir_size.files/2 + 32 * 512; //file attr size + FAT table size + dir_size.bytes /= 1024*1024; //convert to MiB + dir_size.bytes= tmp_size[0] - dir_size.bytes; + tmp[0].draw_progress( + dir_size.bytes*tmp[0].w/tmp_size[0], + tmp_size[0] - dir_size.bytes, + dir_size.bytes, + "M" + ); + } + } + } +} + +void DrawBlockHeader(dword _x, _y, _icon, _title, _subtitle) +{ + #define ICONGAP 45 + WriteTextB(_x+ICONGAP, _y, 0x90, system.color.work_text, _title); + DrawIcon32(_x, _y, system.color.work, _icon); + WriteText(_x+ICONGAP, _y+20, 0x90, system.color.work_text, _subtitle); +} + +dword GetCpuLoad(dword max_h) +{ + dword idle; + dword CPU_SEC = GetCpuFrequency() >> 20 + 1; + dword IDLE_SEC = GetCpuIdleCount() >> 20 * max_h; + + EAX = IDLE_SEC; + EBX = CPU_SEC; + $cdq + $div ebx + idle = EAX; + + return max_h - idle; +} + +dword GetDiskSize(dword disk_n) +{ + BDVK bdvk; + char tmp_path[8]; + strcpy(#tmp_path, "/tmp0/1"); + tmp_path[4] = disk_n + '0'; + GetFileInfo(#tmp_path, #bdvk); + return bdvk.sizelo; +} +void GetTmpDiskSizes() +{ + char i; + for (i=0; i<=9; i++) + { + tmp_size[i] = GetDiskSize(i) / 1024 / 1024; + } +} + +//===================================================// +// // +// MONITORS // +// // +//===================================================// + +int pos=0; +void MonitorCpu() +{ + int i; + if (!cpu.w) return; + + cpu_stack[pos] = GetCpuLoad(cpu.h); + if (cpu_stack[pos]<=2) || (cpu_stack[pos]>cpu.h) cpu_stack[pos]=2; + + DrawBar(cpu.x+cpu.w-30, cpu.y-25, 30, 20, system.color.work); + sprintf(#param, "%i%%", cpu_stack[pos]); + WriteText(cpu.x+cpu.w-calc(strlen(#param)*8), cpu.y-25, 0x90, system.color.work_text, #param); + + for (i=0; i=WIN_CONTENT_W) { + pos = WIN_CONTENT_W-1; + for (i=0; i2) break; - if (Form.width < 300) { MoveSize(OLD,OLD,300,OLD); break; } - if (Form.height < 200) { MoveSize(OLD,OLD,OLD,200); break; } - SelectList_Init(6, 6, Form.cwidth-12 - scroll1.size_x, Form.cheight-12-BOTPANEL_H, false); + case evReDraw: + _PROCESS_REDRAW: + if (!Sysmon__DefineAndDrawWindow()) break; + + SelectList_Init(WIN_PAD, WIN_CONTENT_Y, + WIN_CONTENT_W-scroll1.size_x, + WIN_CONTENT_H-BOTPANEL_H-TAB_HEIGHT, false); SelectList_DrawBorder(); - DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, 4, system.color.work); + + //DrawWideRectangle(0, 0, Form.cwidth, Form.cheight, 4, system.color.work); DrawBar(select_list.x-2, select_list.y+select_list.h+2, select_list.w+scroll1.size_x+4, BOTPANEL_H, system.color.work); - DrawCaptButton(Form.cwidth-116, + DrawCaptButton(Form.cwidth-110-WIN_PAD, select_list.y+select_list.h+5, 110,25,BTN_ID_KILL_PROCESS,0xF38181, 0xFFFfff, T_END_PROCESS); - DrawCaptButton(Form.cwidth-236, + DrawCaptButton(Form.cwidth-230-WIN_PAD, select_list.y+select_list.h+5, 110,25,BTN_ID_SHOW_PROCESS_INFO, system.color.work_button, system.color.work_button_text, T_DETAILS); @@ -113,16 +92,11 @@ void main() } } -void SelectList_LineChanged() -{ - GetProcessList(); - SelectList_Draw(); -} - - -void GetProcessList() +void Processes__GetProcessList() { int i, j; + proc_info Process; + select_list.count=0; for (i=0; i> 20 + 1; - dword IDLE_SEC = GetCpuIdleCount() >> 20 * max_h; - - EAX = IDLE_SEC; - EBX = CPU_SEC; - $cdq - $div ebx - idle = EAX; - - return max_h - idle; -} - -dword GetDiskSize(dword disk_n) -{ - BDVK bdvk; - char tmp_path[8]; - strcpy(#tmp_path, "/tmp0/1"); - tmp_path[4] = disk_n + '0'; - GetFileInfo(#tmp_path, #bdvk); - return bdvk.sizelo; -} -void GetTmpDiskSizes() -{ - char i; - for (i=0; i<=9; i++) - { - tmp_size[i] = GetDiskSize(i) / 1024 / 1024; - } + system.color.get(); + DefineAndDrawWindow(screen.width - WIN_CONTENT_H - 200, 100, WIN_CONTENT_W + WIN_PAD + WIN_PAD +9, + WIN_CONTENT_H + TAB_HEIGHT + skin_height + 4, 0x34, system.color.work, "System Monitor",0); + 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(); + tabs.draw_button(tabs.x+TAB_PADDING, TAB_GENERAL, T_GENERAL); + tabs.draw_button(strlen(T_GENERAL)*8+tabs.x+TAB_PADDING+TAB_PADDING, TAB_PROCESSES, T_PROCESSES); + return true; } //===================================================// // // -// MONITORS // +// EVENTS // // // //===================================================// -int pos=0; -void MonitorCpu() +void Sysmon__ButtonEvent(dword id) { - int i; - if (!cpu.w) return; - - cpu_stack[pos] = GetCpuLoad(cpu.h); - if (cpu_stack[pos]<=2) || (cpu_stack[pos]>cpu.h) cpu_stack[pos]=2; - - DrawBar(cpu.x+cpu.w-30, cpu.y-25, 30, 20, system.color.work); - sprintf(#param, "%i%%", cpu_stack[pos]); - WriteText(cpu.x+cpu.w-calc(strlen(#param)*8), cpu.y-25, 0x90, system.color.work_text, #param); - - for (i=0; i=CPU_STACK) { - pos = CPU_STACK-1; - for (i=0; i