forked from KolibriOS/kolibrios
Notes: save window position
PanelsCfg: fix Docky icon Sysmon: fix tmpdisk size git-svn-id: svn://kolibrios.org@7532 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b57b1483b3
commit
f3d40e9f11
20
programs/cmm/notes/ini.h
Normal file
20
programs/cmm/notes/ini.h
Normal file
@ -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);
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user