From f3d40e9f112eaad1e1ab46610c28474924717910 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Tue, 6 Nov 2018 15:54:32 +0000 Subject: [PATCH] Notes: save window position PanelsCfg: fix Docky icon Sysmon: fix tmpdisk size git-svn-id: svn://kolibrios.org@7532 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/notes/ini.h | 20 ++++++++++++++++++++ programs/cmm/notes/notes.c | 10 ++++++++-- programs/cmm/panels_cfg/panels_cfg.c | 2 +- programs/cmm/sysmon/sysmon.c | 20 +++++++++++++------- 4 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 programs/cmm/notes/ini.h diff --git a/programs/cmm/notes/ini.h b/programs/cmm/notes/ini.h new file mode 100644 index 0000000000..42e8e2d515 --- /dev/null +++ b/programs/cmm/notes/ini.h @@ -0,0 +1,20 @@ +#include "../lib/obj/libini.h" + +_ini ini = { "/sys/settings/app.ini", "Notes" }; + +void LoadIniSettings() +{ + load_dll(libini, #lib_init,1); + Form.left = ini.GetInt("WinX", 150); + Form.top = ini.GetInt("WinY", 50); + //Form.width = ini.GetInt("WinW", 640); + //Form.height = ini.GetInt("WinH", 560); +} + +void SaveIniSettings() +{ + ini.SetInt("WinX", Form.left); + ini.SetInt("WinY", Form.top); + //ini.SetInt("WinW", Form.width); + //ini.SetInt("WinH", Form.height); +} \ No newline at end of file diff --git a/programs/cmm/notes/notes.c b/programs/cmm/notes/notes.c index 8c6149494e..d1b1994283 100644 --- a/programs/cmm/notes/notes.c +++ b/programs/cmm/notes/notes.c @@ -39,7 +39,10 @@ unsigned char edge[sizeof(file "img/edge.raw")]= FROM "img/edge.raw"; //292x6 #define DELETE_BTN 4; #define DELETE_W sizeof(DELETE_TEXT)+2*6 +proc_info Form; + #include "engine.h" +#include "ini.h" dword ed_mouse; edit_box notebox = {NULL,NULL,NULL,COL_BG_ACTIVE,0x94AECE,COL_BG_ACTIVE,0xffffff,0, @@ -68,6 +71,7 @@ void main() if (param) notes.OpenTxt(#param); else notes.OpenTxt(abspath("notes.txt")); SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER); + LoadIniSettings(); loop() switch(WaitEvent()) { @@ -164,9 +168,10 @@ void draw_window() { int i; if (window_dragable) - DefineUnDragableWindow(100,100,WIN_W, WIN_H); + DefineUnDragableWindow(Form.left,Form.top,WIN_W, WIN_H); else - DefineDragableWindow(100,100,WIN_W, WIN_H); + DefineDragableWindow(Form.left,Form.top,WIN_W, WIN_H); + GetProcessInfo(#Form, SelfInfo); notes.SetSizes(RED_LINE_X+1, HEADER_HEIGHT, WIN_W-1, RED_LINE_X*LINES_COUNT, RED_LINE_X); DrawRectangle3D(0,0,WIN_W,TITLE_H-1,0xBB6535, 0xCD6F3B); DrawRectangle3D(1,1,WIN_W-2,TITLE_H-3,0xEFBFA4, 0xDD8452); @@ -213,6 +218,7 @@ void EventActivateLine(int line_n) void EventExitApp() { notes.SaveTxt(); + SaveIniSettings(); ExitProcess(); } diff --git a/programs/cmm/panels_cfg/panels_cfg.c b/programs/cmm/panels_cfg/panels_cfg.c index 06f9bd2acb..9e538997cc 100644 --- a/programs/cmm/panels_cfg/panels_cfg.c +++ b/programs/cmm/panels_cfg/panels_cfg.c @@ -180,7 +180,7 @@ void DrawWindowContent() //DOCKY frame_y = calc(y.inc(20)); DefineButton(22, y.inc(18), PIMG_W-1, PIMG_H-1, 200 + BT_HIDE, 0); - DrawPanelsImage(y.n, dkLocation); + DrawPanelsImage(y.n, dkLocation+1); WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS); dkFsize.draw(22, y.inc(35)); dkAshow.draw(win_center_x, y.n); diff --git a/programs/cmm/sysmon/sysmon.c b/programs/cmm/sysmon/sysmon.c index a1779ca7c5..9f75f00298 100644 --- a/programs/cmm/sysmon/sysmon.c +++ b/programs/cmm/sysmon/sysmon.c @@ -48,7 +48,7 @@ void main() load_dll(libimg, #libimg_init,1); load_dll(libini, #lib_init,1); - GetTmpDiskSizesFromIni(); + GetTmpDiskSizes(); loop() { @@ -153,15 +153,21 @@ dword GetCpuLoad(dword max_h) return max_h - idle; } -_ini ini = { "/sys/settings/system.ini", "DiskSizes" }; -void GetTmpDiskSizesFromIni() +dword GetDiskSize(dword disk_n) { - char i, key[2]; - key[1]=0; + 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++) { - key[0]=i+'0'; - tmp_size[i] = ini.GetInt(#key, 0) / 1024 / 1024; + tmp_size[i] = GetDiskSize(i) / 1024 / 1024; } }