2015-03-07 15:16:32 +01:00
|
|
|
|
#ifndef AUTOBUILD
|
|
|
|
|
#include "lang.h--"
|
|
|
|
|
#endif
|
2015-02-25 19:38:01 +01:00
|
|
|
|
|
|
|
|
|
#define MEMSIZE 0x23E80
|
|
|
|
|
#include "..\lib\kolibri.h"
|
|
|
|
|
#include "..\lib\strings.h"
|
|
|
|
|
#include "..\lib\mem.h"
|
2018-04-03 15:57:56 +02:00
|
|
|
|
#include "..\lib\fs.h"
|
2015-02-25 19:38:01 +01:00
|
|
|
|
#include "..\lib\dll.h"
|
2015-03-05 21:55:28 +01:00
|
|
|
|
#include "..\lib\gui.h"
|
2015-02-25 19:38:01 +01:00
|
|
|
|
|
2017-10-05 00:59:57 +02:00
|
|
|
|
#include "..\lib\obj\libio.h"
|
2015-03-05 21:55:28 +01:00
|
|
|
|
#include "..\lib\obj\libini.h"
|
|
|
|
|
#include "..\lib\obj\box_lib.h"
|
2015-02-25 19:38:01 +01:00
|
|
|
|
|
2015-03-25 12:46:22 +01:00
|
|
|
|
#include "..\lib\patterns\restart_process.h"
|
2015-02-25 19:38:01 +01:00
|
|
|
|
|
2015-03-07 15:16:32 +01:00
|
|
|
|
#ifdef LANG_RUS
|
2015-03-07 19:11:31 +01:00
|
|
|
|
?define WINDOW_TITLE "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ன<EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD>"
|
|
|
|
|
?define TASK_FRAME_T " <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> "
|
|
|
|
|
?define DOCK_FRAME_T " <20><><EFBFBD> "
|
2015-03-07 15:16:32 +01:00
|
|
|
|
?define MIN_LEFT_BUTTON "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <><E1ABA5>"
|
|
|
|
|
?define MIN_RIGHT_BUTTON "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ࠢ<EFBFBD>"
|
|
|
|
|
?define SOFTEN_UP "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᢥ<><E1A2A5><EFBFBD>"
|
|
|
|
|
?define SOFTEN_DOWN "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᭨<><E1ADA8>"
|
|
|
|
|
?define CLOCK "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
?define CPU_USAGE "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>㧪<EFBFBD> <20><>"
|
|
|
|
|
?define CHANGE_LANG "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
?define MENU_BUTTON "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>"
|
|
|
|
|
?define PANEL_HEIGHT "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
?define SOFTEN_HEIGHT "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ᣫ<><E1A3AB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
?define BUTTON_OFFSET "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
?define FSIZE "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"
|
|
|
|
|
?define ASHOW "<EFBFBD><EFBFBD> <20><><EFBFBD>뢠<EFBFBD><EBA2A0>"
|
|
|
|
|
?define CHANGE_POS "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD>ࠦ<EFBFBD><E0A0A6><EFBFBD><EFBFBD> <20><><EFBFBD> ᬥ<><E1ACA5> <20><><EFBFBD><EFBFBD>樨"
|
|
|
|
|
#else
|
2015-03-07 19:11:31 +01:00
|
|
|
|
?define WINDOW_TITLE "Taskbar and Docky configuration"
|
|
|
|
|
?define TASK_FRAME_T " Taskbar "
|
|
|
|
|
?define DOCK_FRAME_T " Docky "
|
2015-03-07 15:16:32 +01:00
|
|
|
|
?define MIN_LEFT_BUTTON "Min Left Button"
|
|
|
|
|
?define MIN_RIGHT_BUTTON "Min Right Button"
|
|
|
|
|
?define SOFTEN_UP "Soften Up"
|
|
|
|
|
?define SOFTEN_DOWN "Soften Down"
|
|
|
|
|
?define CLOCK "Clock"
|
|
|
|
|
?define CPU_USAGE "Cpu Usage"
|
2015-03-07 20:44:58 +01:00
|
|
|
|
?define CHANGE_LANG "Change Language"
|
2015-03-07 15:16:32 +01:00
|
|
|
|
?define MENU_BUTTON "Menu Button"
|
|
|
|
|
?define PANEL_HEIGHT "Panel Height"
|
|
|
|
|
?define SOFTEN_HEIGHT "Soften Height"
|
|
|
|
|
?define BUTTON_OFFSET "Button Offset"
|
|
|
|
|
?define FSIZE "Full width"
|
|
|
|
|
?define ASHOW "Always show"
|
|
|
|
|
?define CHANGE_POS "Click on image to change position"
|
|
|
|
|
#endif
|
|
|
|
|
|
2015-02-25 19:38:01 +01:00
|
|
|
|
char taskbar_ini_path[] = "/sys/settings/taskbar.ini";
|
2017-10-05 11:37:50 +02:00
|
|
|
|
_ini taskbar_flags_ini = { #taskbar_ini_path, "Flags" };
|
|
|
|
|
_ini taskbar_vars_ini = { #taskbar_ini_path, "Variables" };
|
|
|
|
|
|
|
|
|
|
_ini docky_ini = { "/sys/settings/docky.ini", "@" };
|
2015-02-25 19:38:01 +01:00
|
|
|
|
|
2015-02-26 17:48:22 +01:00
|
|
|
|
unsigned char panels_img_data[] = FROM "panels_image.raw";
|
2018-10-13 23:20:17 +02:00
|
|
|
|
#define PIMG_W 37
|
|
|
|
|
#define PIMG_H 27 //27*5
|
2015-02-25 19:38:01 +01:00
|
|
|
|
|
|
|
|
|
proc_info Form;
|
|
|
|
|
|
2018-04-19 22:12:07 +02:00
|
|
|
|
enum { BTN_TB_ATTACHEMENT=100, BTN_DOCKY_ATTACHEMENT=200 };
|
|
|
|
|
enum { TASKBAR, DOCKY };
|
2015-02-25 19:38:01 +01:00
|
|
|
|
|
2018-04-19 16:16:32 +02:00
|
|
|
|
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 };
|
2015-02-25 19:38:01 +01:00
|
|
|
|
|
2018-04-19 22:12:07 +02:00
|
|
|
|
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;
|
|
|
|
|
|
|
|
|
|
|
2015-02-25 19:38:01 +01:00
|
|
|
|
void main()
|
|
|
|
|
{
|
|
|
|
|
dword id, key;
|
|
|
|
|
|
2015-07-30 16:54:30 +02:00
|
|
|
|
load_dll(libini, #lib_init,1);
|
2015-07-29 22:43:05 +02:00
|
|
|
|
load_dll(boxlib, #box_lib_init,0);
|
2015-02-25 19:38:01 +01:00
|
|
|
|
|
|
|
|
|
LoadCfg();
|
|
|
|
|
|
|
|
|
|
loop() switch(WaitEvent())
|
|
|
|
|
{
|
|
|
|
|
case evButton:
|
|
|
|
|
id=GetButtonID();
|
2018-04-19 22:12:07 +02:00
|
|
|
|
if (1==id) ExitProcess();
|
2015-02-25 19:38:01 +01:00
|
|
|
|
//taskbar buttons
|
2018-04-19 22:12:07 +02:00
|
|
|
|
if (BTN_TB_ATTACHEMENT == id) {
|
|
|
|
|
tbAttachment ^= 1;
|
|
|
|
|
DrawWindowContent();
|
|
|
|
|
SaveSettingsAndRestartProcess(TASKBAR);
|
2015-02-25 19:38:01 +01:00
|
|
|
|
}
|
2018-04-19 22:12:07 +02:00
|
|
|
|
|
|
|
|
|
if (tbSoftenUp.click(id)) || (tbSoftenDown.click(id))
|
|
|
|
|
|| (tbMinLeftButton.click(id)) || (tbMinRightButton.click(id))
|
|
|
|
|
|| (tbRunApplButton.click(id)) || (tbClnDeskButton.click(id)) {
|
|
|
|
|
SaveSettingsAndRestartProcess(TASKBAR);
|
2015-02-25 19:38:01 +01:00
|
|
|
|
}
|
2018-04-19 22:12:07 +02:00
|
|
|
|
|
|
|
|
|
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) {
|
|
|
|
|
dkLocation++;
|
|
|
|
|
if (dkLocation>3) dkLocation=1;
|
|
|
|
|
DrawWindowContent();
|
|
|
|
|
SaveSettingsAndRestartProcess(DOCKY);
|
|
|
|
|
}
|
|
|
|
|
if (dkFsize.click(id)) SaveSettingsAndRestartProcess(DOCKY);
|
|
|
|
|
if (dkAshow.click(id)) SaveSettingsAndRestartProcess(DOCKY);
|
2015-02-25 19:38:01 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evKey:
|
2019-04-16 23:21:19 +02:00
|
|
|
|
GetKeys();
|
|
|
|
|
if (key_scancode == SCAN_CODE_ESC) ExitProcess();
|
2015-02-25 19:38:01 +01:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case evReDraw:
|
2015-08-04 16:36:07 +02:00
|
|
|
|
system.color.get();
|
2017-10-05 11:37:50 +02:00
|
|
|
|
DefineAndDrawWindow(130, 150, 465, 398 + skin_height, 0x34, system.color.work, WINDOW_TITLE, 0);
|
2015-02-25 19:38:01 +01:00
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
|
if (Form.status_window>2) break;
|
2018-04-19 22:12:07 +02:00
|
|
|
|
DrawWindowContent();
|
2015-02-25 19:38:01 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2018-10-13 23:20:17 +02:00
|
|
|
|
void DrawPanelsImage(dword y, n)
|
|
|
|
|
{
|
|
|
|
|
_PutImage(22, y, PIMG_W, PIMG_H, n * PIMG_W * PIMG_H * 3 + #panels_img_data);
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-19 22:12:07 +02:00
|
|
|
|
void DrawWindowContent()
|
2015-02-25 19:38:01 +01:00
|
|
|
|
{
|
2018-04-16 00:44:36 +02:00
|
|
|
|
#define PD 10
|
|
|
|
|
dword frame_y;
|
2016-02-11 14:46:53 +01:00
|
|
|
|
word win_center_x = Form.cwidth / 2 + 20;
|
|
|
|
|
incn y;
|
2015-02-25 19:38:01 +01:00
|
|
|
|
|
2018-04-19 22:12:07 +02:00
|
|
|
|
frame_y = 15;
|
|
|
|
|
y.n = frame_y;
|
2018-10-13 23:20:17 +02:00
|
|
|
|
DefineButton(22, y.inc(18), PIMG_W-1, PIMG_H-1, 100 + BT_HIDE, 0);
|
|
|
|
|
DrawPanelsImage(y.n, tbAttachment);
|
2018-04-19 22:12:07 +02:00
|
|
|
|
WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
|
|
|
|
|
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);
|
|
|
|
|
//DOCKY
|
|
|
|
|
frame_y = calc(y.inc(20));
|
2018-10-13 23:20:17 +02:00
|
|
|
|
DefineButton(22, y.inc(18), PIMG_W-1, PIMG_H-1, 200 + BT_HIDE, 0);
|
2018-11-06 16:54:32 +01:00
|
|
|
|
DrawPanelsImage(y.n, dkLocation+1);
|
2018-04-19 22:12:07 +02:00
|
|
|
|
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);
|
|
|
|
|
DrawFrame(PD, frame_y, Form.cwidth-PD-PD, Form.cheight-frame_y-PD, DOCK_FRAME_T);
|
2015-02-25 19:38:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void LoadCfg()
|
|
|
|
|
{
|
2018-04-19 22:12:07 +02:00
|
|
|
|
tbAttachment = taskbar_flags_ini.GetInt("Attachment", 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);
|
2018-04-19 16:16:32 +02:00
|
|
|
|
tbPanelHeight.value = taskbar_vars_ini.GetInt("PanelHeight", 28);
|
|
|
|
|
tbSoftenHeight.value = taskbar_vars_ini.GetInt("SoftenHeight", 4);
|
|
|
|
|
tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonTopOffset", 3);
|
|
|
|
|
tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonBotOffset", 3);
|
2015-02-25 19:38:01 +01:00
|
|
|
|
|
2017-10-05 11:37:50 +02:00
|
|
|
|
dkLocation = docky_ini.GetInt("location", 0);
|
2018-04-19 22:12:07 +02:00
|
|
|
|
dkFsize.checked = docky_ini.GetInt("fsize", 0);
|
|
|
|
|
dkAshow.checked = docky_ini.GetInt("ashow", 0);
|
2015-02-25 19:38:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
2018-04-19 22:12:07 +02:00
|
|
|
|
void SaveSettingsAndRestartProcess(byte panel_type)
|
2015-02-25 19:38:01 +01:00
|
|
|
|
{
|
2015-02-26 17:48:22 +01:00
|
|
|
|
if (panel_type==TASKBAR) {
|
2017-10-05 11:37:50 +02:00
|
|
|
|
taskbar_flags_ini.SetInt("Attachment", tbAttachment);
|
2018-04-19 22:12:07 +02:00
|
|
|
|
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);
|
2018-04-19 16:16:32 +02:00
|
|
|
|
taskbar_vars_ini.SetInt("PanelHeight", tbPanelHeight.value);
|
|
|
|
|
taskbar_vars_ini.SetInt("SoftenHeight", tbSoftenHeight.value);
|
|
|
|
|
taskbar_vars_ini.SetInt("ButtonTopOffset", tbButtonOffset.value);
|
|
|
|
|
taskbar_vars_ini.SetInt("ButtonBottOffset", tbButtonOffset.value);
|
2015-02-26 17:48:22 +01:00
|
|
|
|
}
|
|
|
|
|
if (panel_type==DOCKY) {
|
2017-10-05 11:37:50 +02:00
|
|
|
|
docky_ini.SetInt("location", dkLocation);
|
2018-04-19 22:12:07 +02:00
|
|
|
|
docky_ini.SetInt("fsize", dkFsize.checked);
|
|
|
|
|
docky_ini.SetInt("ashow", dkAshow.checked);
|
2015-02-26 17:48:22 +01:00
|
|
|
|
}
|
2018-04-19 22:12:07 +02:00
|
|
|
|
RestartProcess(panel_type);
|
2015-02-25 19:38:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-02-26 17:48:22 +01:00
|
|
|
|
void RestartProcess(byte panel_type)
|
2015-02-25 19:38:01 +01:00
|
|
|
|
{
|
2015-03-25 12:46:22 +01:00
|
|
|
|
dword proc_name1;
|
|
|
|
|
if (panel_type == TASKBAR)
|
2015-02-25 19:38:01 +01:00
|
|
|
|
{
|
2015-03-25 12:46:22 +01:00
|
|
|
|
RestartProcessByName("@taskbar", SINGLE);
|
|
|
|
|
pause(50);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
RestartProcessByName("@docky", SINGLE);
|
|
|
|
|
pause(120);
|
2015-02-25 19:38:01 +01:00
|
|
|
|
}
|
|
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
2015-02-26 17:48:22 +01:00
|
|
|
|
ActivateWindow(GetProcessSlot(Form.ID));
|
2015-02-25 19:38:01 +01:00
|
|
|
|
}
|
|
|
|
|
|
2015-02-26 17:48:22 +01:00
|
|
|
|
|
|
|
|
|
|
2015-02-25 19:38:01 +01:00
|
|
|
|
stop:
|