Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7243 → Rev 7244

/programs/cmm/panels_cfg/panels_cfg.c
65,22 → 65,30
 
proc_info Form;
 
word dkFsize;
byte dkLocation, dkAshow;
enum { BTN_TB_ATTACHEMENT=100, BTN_DOCKY_ATTACHEMENT=200 };
enum { TASKBAR, DOCKY };
 
byte tbAttachment, tbSoftenUp, tbSoftenDown, tbMinLeftButton, tbMinRightButton,
tbMenuButton, tbRunApplButton, tbClnDeskButton, tbClock, tbCpuUsage, tbChangeLang;
 
enum {
TASKBAR,
DOCKY,
ALL
};
 
more_less_box tbPanelHeight = { NULL, 6, 99, PANEL_HEIGHT };
more_less_box tbSoftenHeight = { NULL, 0, 99, SOFTEN_HEIGHT };
more_less_box tbButtonOffset = { NULL, 0, 99, BUTTON_OFFSET };
 
int tbAttachment;
checkbox tbSoftenUp = { SOFTEN_UP };
checkbox tbClock = { CLOCK };
checkbox tbSoftenDown = { SOFTEN_DOWN };
checkbox tbCpuUsage = { CPU_USAGE };
checkbox tbMinLeftButton = { MIN_LEFT_BUTTON };
checkbox tbChangeLang = { CHANGE_LANG };
checkbox tbMinRightButton = { MIN_RIGHT_BUTTON };
checkbox tbMenuButton = { MENU_BUTTON };
checkbox dkFsize = { FSIZE };
checkbox dkAshow = { ASHOW };
 
int dkLocation;
checkbox tbRunApplButton;
checkbox tbClnDeskButton;
 
 
void main()
{
dword id, key;
94,42 → 102,35
{
case evButton:
id=GetButtonID();
if (id==1) ExitProcess();
if (1==id) ExitProcess();
//taskbar buttons
if (id>=100) && (id<200)
{
if (id==100) tbAttachment ^= 1;
if (id==105) tbSoftenUp ^= 1;
if (id==106) tbSoftenDown ^= 1;
if (id==107) tbMinLeftButton ^= 1;
if (id==108) tbMinRightButton ^= 1;
if (id==109) tbRunApplButton ^= 1;
if (id==110) tbClnDeskButton ^= 1;
if (id==111) tbClock ^= 1;
if (id==112) tbCpuUsage ^= 1;
if (id==113) tbChangeLang ^= 1;
if (id==114) tbMenuButton ^= 1;
tbPanelHeight.click(id);
tbSoftenHeight.click(id);
tbButtonOffset.click(id);
DrawWindowContent(TASKBAR);
SaveCfg(TASKBAR);
RestartProcess(TASKBAR);
if (BTN_TB_ATTACHEMENT == id) {
tbAttachment ^= 1;
DrawWindowContent();
SaveSettingsAndRestartProcess(TASKBAR);
}
 
if (tbSoftenUp.click(id)) || (tbSoftenDown.click(id))
|| (tbMinLeftButton.click(id)) || (tbMinRightButton.click(id))
|| (tbRunApplButton.click(id)) || (tbClnDeskButton.click(id)) {
SaveSettingsAndRestartProcess(TASKBAR);
}
 
if (tbClock.click(id)) || (tbCpuUsage.click(id))
|| (tbChangeLang.click(id)) || (tbMenuButton.click(id))
|| (tbPanelHeight.click(id)) || (tbSoftenHeight.click(id))
|| (tbButtonOffset.click(id)) {
SaveSettingsAndRestartProcess(TASKBAR);
}
//docky buttons
if (id>=200)
{
if (id==200)
{
if (id==200) {
dkLocation++;
if (dkLocation>3) dkLocation=1;
DrawWindowContent();
SaveSettingsAndRestartProcess(DOCKY);
}
if (id==201) dkFsize ^= 1;
if (id==202) dkAshow ^= 1;
DrawWindowContent(DOCKY);
SaveCfg(DOCKY);
RestartProcess(DOCKY);
}
if (dkFsize.click(id)) SaveSettingsAndRestartProcess(DOCKY);
if (dkAshow.click(id)) SaveSettingsAndRestartProcess(DOCKY);
break;
case evKey:
142,11 → 143,11
DefineAndDrawWindow(130, 150, 465, 398 + skin_height, 0x34, system.color.work, WINDOW_TITLE, 0);
GetProcessInfo(#Form, SelfInfo);
if (Form.status_window>2) break;
DrawWindowContent(ALL);
DrawWindowContent();
}
}
 
void DrawWindowContent(byte panel_type)
void DrawWindowContent()
{
#define PD 10
dword frame_y;
153,49 → 154,44
word win_center_x = Form.cwidth / 2 + 20;
incn y;
 
if (panel_type==ALL) || (panel_type==TASKBAR)
{
frame_y = 15;
y.n = frame_y;
DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 100 + BT_HIDE, 0);
_PutImage(22, y.n, 37, 27, tbAttachment * 37 * 27 * 3 + panels_img.data);
WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
CheckBox(22, y.inc(35), 105, SOFTEN_UP, tbSoftenUp);
CheckBox(win_center_x, y.n, 111, CLOCK, tbClock);
CheckBox(22, y.inc(24), 106, SOFTEN_DOWN, tbSoftenDown);
CheckBox(win_center_x, y.n, 112, CPU_USAGE, tbCpuUsage);
CheckBox(22, y.inc(24), 107, MIN_LEFT_BUTTON, tbMinLeftButton);
CheckBox(win_center_x, y.n, 113, CHANGE_LANG, tbChangeLang);
CheckBox(22, y.inc(24), 108, MIN_RIGHT_BUTTON, tbMinRightButton);
CheckBox(win_center_x, y.n, 114, MENU_BUTTON, tbMenuButton);
tbSoftenUp.draw(22, y.inc(35));
tbClock.draw(win_center_x, y.n);
tbSoftenDown.draw(22, y.inc(24));
tbCpuUsage.draw(win_center_x, y.n);
tbMinLeftButton.draw(22, y.inc(24));
tbChangeLang.draw(win_center_x, y.n);
tbMinRightButton.draw(22, y.inc(24));
tbMenuButton.draw(win_center_x, y.n);
tbPanelHeight.draw(22, y.inc(28));
tbSoftenHeight.draw(22, y.inc(32));
tbButtonOffset.draw(22, y.inc(32));
DrawFrame(PD, frame_y, Form.cwidth-PD-PD, y.inc(32)-frame_y, TASK_FRAME_T);
}
if (panel_type==ALL) || (panel_type==DOCKY)
{
//DOCKY
frame_y = calc(y.inc(20));
DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 200 + BT_HIDE, 0);
_PutImage(22, y.n, 37, 27, dkLocation + 1 * 37 * 27 * 3 + panels_img.data);
WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
CheckBox(22, y.inc(35), 201, FSIZE, dkFsize);
CheckBox(win_center_x, y.n, 202, ASHOW, dkAshow);
dkFsize.draw(22, y.inc(35));
dkAshow.draw(win_center_x, y.n);
DrawFrame(PD, frame_y, Form.cwidth-PD-PD, Form.cheight-frame_y-PD, DOCK_FRAME_T);
}
}
 
void LoadCfg()
{
tbAttachment = taskbar_flags_ini.GetInt("Attachment", 1);
tbSoftenUp = taskbar_flags_ini.GetInt("SoftenUp", 1);
tbSoftenDown = taskbar_flags_ini.GetInt("SoftenDown", 1);
tbMinLeftButton = taskbar_flags_ini.GetInt("MinLeftButton", 1);
tbMinRightButton = taskbar_flags_ini.GetInt("MinRightButton", 1);
tbClock = taskbar_flags_ini.GetInt("Clock", 1);
tbCpuUsage = taskbar_flags_ini.GetInt("CpuUsage", 1);
tbChangeLang = taskbar_flags_ini.GetInt("ChangeLang", 1);
tbMenuButton = taskbar_flags_ini.GetInt("MenuButton", 1);
tbSoftenUp.checked = taskbar_flags_ini.GetInt("SoftenUp", 1);
tbSoftenDown.checked = taskbar_flags_ini.GetInt("SoftenDown", 1);
tbMinLeftButton.checked = taskbar_flags_ini.GetInt("MinLeftButton", 1);
tbMinRightButton.checked = taskbar_flags_ini.GetInt("MinRightButton", 1);
tbClock.checked = taskbar_flags_ini.GetInt("Clock", 1);
tbCpuUsage.checked = taskbar_flags_ini.GetInt("CpuUsage", 1);
tbChangeLang.checked = taskbar_flags_ini.GetInt("ChangeLang", 1);
tbMenuButton.checked = taskbar_flags_ini.GetInt("MenuButton", 1);
tbPanelHeight.value = taskbar_vars_ini.GetInt("PanelHeight", 28);
tbSoftenHeight.value = taskbar_vars_ini.GetInt("SoftenHeight", 4);
tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonTopOffset", 3);
202,24 → 198,24
tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonBotOffset", 3);
 
dkLocation = docky_ini.GetInt("location", 0);
dkFsize = docky_ini.GetInt("fsize", 0);
dkAshow = docky_ini.GetInt("ashow", 0);
dkFsize.checked = docky_ini.GetInt("fsize", 0);
dkAshow.checked = docky_ini.GetInt("ashow", 0);
}
 
void SaveCfg(byte panel_type)
void SaveSettingsAndRestartProcess(byte panel_type)
{
if (panel_type==TASKBAR) {
taskbar_flags_ini.SetInt("Attachment", tbAttachment);
taskbar_flags_ini.SetInt("SoftenUp", tbSoftenUp);
taskbar_flags_ini.SetInt("SoftenDown", tbSoftenDown);
taskbar_flags_ini.SetInt("MinLeftButton", tbMinLeftButton);
taskbar_flags_ini.SetInt("MinRightButton", tbMinRightButton);
taskbar_flags_ini.SetInt("RunApplButton", tbRunApplButton);
taskbar_flags_ini.SetInt("ClnDeskButton", tbClnDeskButton);
taskbar_flags_ini.SetInt("Clock", tbClock);
taskbar_flags_ini.SetInt("CpuUsage", tbCpuUsage);
taskbar_flags_ini.SetInt("ChangeLang", tbChangeLang);
taskbar_flags_ini.SetInt("MenuButton", tbMenuButton);
taskbar_flags_ini.SetInt("SoftenUp", tbSoftenUp.checked);
taskbar_flags_ini.SetInt("SoftenDown", tbSoftenDown.checked);
taskbar_flags_ini.SetInt("MinLeftButton", tbMinLeftButton.checked);
taskbar_flags_ini.SetInt("MinRightButton", tbMinRightButton.checked);
taskbar_flags_ini.SetInt("RunApplButton", tbRunApplButton.checked);
taskbar_flags_ini.SetInt("ClnDeskButton", tbClnDeskButton.checked);
taskbar_flags_ini.SetInt("Clock", tbClock.checked);
taskbar_flags_ini.SetInt("CpuUsage", tbCpuUsage.checked);
taskbar_flags_ini.SetInt("ChangeLang", tbChangeLang.checked);
taskbar_flags_ini.SetInt("MenuButton", tbMenuButton.checked);
taskbar_vars_ini.SetInt("PanelHeight", tbPanelHeight.value);
taskbar_vars_ini.SetInt("SoftenHeight", tbSoftenHeight.value);
taskbar_vars_ini.SetInt("ButtonTopOffset", tbButtonOffset.value);
227,9 → 223,10
}
if (panel_type==DOCKY) {
docky_ini.SetInt("location", dkLocation);
docky_ini.SetInt("fsize", dkFsize);
docky_ini.SetInt("ashow", dkAshow);
docky_ini.SetInt("fsize", dkFsize.checked);
docky_ini.SetInt("ashow", dkAshow.checked);
}
RestartProcess(panel_type);
}
 
void RestartProcess(byte panel_type)