2015-02-25 21:38:01 +03:00
|
|
|
|
|
|
|
#define MEMSIZE 0x23E80
|
|
|
|
#include "..\lib\kolibri.h"
|
|
|
|
#include "..\lib\strings.h"
|
|
|
|
#include "..\lib\mem.h"
|
|
|
|
#include "..\lib\file_system.h"
|
|
|
|
#include "..\lib\dll.h"
|
2015-03-05 23:55:28 +03:00
|
|
|
#include "..\lib\gui.h"
|
2015-02-25 21:38:01 +03:00
|
|
|
|
2015-03-05 23:55:28 +03:00
|
|
|
#include "..\lib\obj\libio_lib.h"
|
|
|
|
#include "..\lib\obj\libini.h"
|
|
|
|
#include "..\lib\obj\box_lib.h"
|
2015-02-25 21:38:01 +03:00
|
|
|
|
|
|
|
#include "..\lib\patterns\libimg_load_skin.h"
|
|
|
|
|
2015-02-26 21:11:56 +03:00
|
|
|
#define WINDOW_TITLE "Taskbar and Docky configuration"
|
2015-02-25 21:38:01 +03:00
|
|
|
|
2015-02-26 19:48:22 +03:00
|
|
|
frame taskbar_frame = { 0, 000, 10, 188, 14, 0x000111, 0xFFFfff, 1, " Taskbar ", 0, 0, 6, 0x000111, 0xCCCccc };
|
|
|
|
frame docky_frame = { 0, 000, 10, 73, 217, 0x000111, 0xFFFfff, 1, " Docky ", 0, 0, 6, 0x000111, 0xCCCccc };
|
2015-02-25 21:38:01 +03:00
|
|
|
|
|
|
|
char taskbar_ini_path[] = "/sys/settings/taskbar.ini";
|
2015-02-26 19:48:22 +03:00
|
|
|
char taskbar_c_flags[] = "Flags";
|
|
|
|
char taskbar_c_variables[] = "Variables";
|
2015-02-25 21:38:01 +03:00
|
|
|
char docky_ini_path[] = "/sys/settings/docky.ini";
|
|
|
|
|
2015-02-26 19:48:22 +03:00
|
|
|
unsigned char panels_img_data[] = FROM "panels_image.raw";
|
|
|
|
raw_image panels_img = { 37, 27, #panels_img_data };
|
2015-02-25 21:38:01 +03:00
|
|
|
|
|
|
|
system_colors sc;
|
|
|
|
proc_info Form;
|
|
|
|
|
|
|
|
struct docky_cfg {
|
|
|
|
word fsize;
|
|
|
|
byte location, ashow;
|
|
|
|
} docky_cfg;
|
|
|
|
|
|
|
|
struct taskbar_cfg {
|
|
|
|
byte Attachment;
|
2015-02-26 19:48:22 +03:00
|
|
|
byte PanelHeight, SoftenHeight, ButtonOffset;
|
2015-02-25 21:38:01 +03:00
|
|
|
byte SoftenUp, SoftenDown, MinLeftButton, MinRightButton, MenuButton,
|
|
|
|
RunApplButton, ClnDeskButton, Clock, CpuUsage, ChangeLang;
|
|
|
|
} taskbar_cfg;
|
|
|
|
|
2015-02-26 19:48:22 +03:00
|
|
|
enum {
|
|
|
|
TASKBAR,
|
|
|
|
DOCKY
|
|
|
|
};
|
2015-02-25 21:38:01 +03:00
|
|
|
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
|
|
|
dword id, key;
|
|
|
|
|
|
|
|
mem_Init();
|
|
|
|
if (load_dll2(libini, #lib_init,1)!=0) notify("Error: library doesn't exists - libini");
|
|
|
|
if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Eror: library doesn't exists - boxlib");
|
|
|
|
|
|
|
|
LoadCfg();
|
|
|
|
|
|
|
|
loop() switch(WaitEvent())
|
|
|
|
{
|
|
|
|
case evButton:
|
|
|
|
id=GetButtonID();
|
|
|
|
if (id==1) ExitProcess();
|
|
|
|
//taskbar buttons
|
|
|
|
if (id>=100) && (id<200)
|
|
|
|
{
|
|
|
|
if (id==100) taskbar_cfg.Attachment ^= 1;
|
|
|
|
if (id==105) taskbar_cfg.SoftenUp ^= 1;
|
|
|
|
if (id==106) taskbar_cfg.SoftenDown ^= 1;
|
|
|
|
if (id==107) taskbar_cfg.MinLeftButton ^= 1;
|
|
|
|
if (id==108) taskbar_cfg.MinRightButton ^= 1;
|
|
|
|
if (id==109) taskbar_cfg.RunApplButton ^= 1;
|
|
|
|
if (id==110) taskbar_cfg.ClnDeskButton ^= 1;
|
|
|
|
if (id==111) taskbar_cfg.Clock ^= 1;
|
|
|
|
if (id==112) taskbar_cfg.CpuUsage ^= 1;
|
|
|
|
if (id==113) taskbar_cfg.ChangeLang ^= 1;
|
|
|
|
if (id==114) taskbar_cfg.MenuButton ^= 1;
|
2015-02-26 19:48:22 +03:00
|
|
|
if (id==120) taskbar_cfg.PanelHeight++;
|
|
|
|
if (id==121) && (taskbar_cfg.PanelHeight>6) taskbar_cfg.PanelHeight--;
|
|
|
|
if (id==122) taskbar_cfg.SoftenHeight++;
|
|
|
|
if (id==123) && (taskbar_cfg.SoftenHeight>0) taskbar_cfg.SoftenHeight--;
|
|
|
|
if (id==124) taskbar_cfg.ButtonOffset++;
|
|
|
|
if (id==125) && (taskbar_cfg.ButtonOffset>0) taskbar_cfg.ButtonOffset--;
|
|
|
|
DrawWindowContent(TASKBAR);
|
|
|
|
SaveCfg(TASKBAR);
|
|
|
|
RestartProcess(TASKBAR);
|
2015-02-25 21:38:01 +03:00
|
|
|
}
|
|
|
|
//docky buttons
|
|
|
|
if (id>=200)
|
|
|
|
{
|
|
|
|
if (id==200)
|
|
|
|
{
|
|
|
|
if (docky_cfg.location==1) docky_cfg.location = 2;
|
|
|
|
else if (docky_cfg.location==2) docky_cfg.location = 3;
|
|
|
|
else if (docky_cfg.location==3) docky_cfg.location = 1;
|
|
|
|
}
|
|
|
|
if (id==201) docky_cfg.fsize ^= 1;
|
|
|
|
if (id==202) docky_cfg.ashow ^= 1;
|
2015-02-26 19:48:22 +03:00
|
|
|
DrawWindowContent(DOCKY);
|
|
|
|
SaveCfg(DOCKY);
|
|
|
|
RestartProcess(DOCKY);
|
2015-02-25 21:38:01 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evKey:
|
|
|
|
key = GetKey();
|
|
|
|
if (key==27) ExitProcess();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evReDraw:
|
|
|
|
sc.get();
|
2015-02-26 19:48:22 +03:00
|
|
|
DefineAndDrawWindow(130, 150, 390, 300+GetSkinHeight(),0x34,sc.work,WINDOW_TITLE);
|
2015-02-25 21:38:01 +03:00
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
if (Form.status_window>2) break;
|
|
|
|
taskbar_frame.size_x = docky_frame.size_x = - taskbar_frame.start_x * 2 + Form.cwidth;
|
|
|
|
taskbar_frame.font_color = docky_frame.font_color = sc.work_text;
|
|
|
|
taskbar_frame.font_backgr_color = docky_frame.font_backgr_color = sc.work;
|
2015-02-26 19:48:22 +03:00
|
|
|
taskbar_frame.ext_col = docky_frame.ext_col = sc.work_graph;
|
2015-02-25 21:38:01 +03:00
|
|
|
DrawWindowContent();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void DrawWindowContent()
|
|
|
|
{
|
|
|
|
word win_center_x;
|
|
|
|
|
|
|
|
frame_draw stdcall (#taskbar_frame);
|
2015-02-26 19:48:22 +03:00
|
|
|
DefineButton(22, taskbar_frame.start_y + 12, panels_img.w-1, 27-1, 100 + BT_HIDE, 0);
|
|
|
|
_PutImage(22, taskbar_frame.start_y + 12, 37, 27, taskbar_cfg.Attachment * 37 * 27 * 3 + panels_img.data);
|
2015-02-25 21:38:01 +03:00
|
|
|
WriteText(68, taskbar_frame.start_y + 20, 0x80, 0x333222, "Click on image to change position");
|
2015-02-26 19:48:22 +03:00
|
|
|
PanelCfg_CheckBox(22, taskbar_frame.start_y + 48, 105, "Soften Up", taskbar_cfg.SoftenUp);
|
|
|
|
PanelCfg_CheckBox(22, taskbar_frame.start_y + 68, 106, "Soften Down", taskbar_cfg.SoftenDown);
|
|
|
|
PanelCfg_CheckBox(22, taskbar_frame.start_y + 88, 107, "Min Left Button", taskbar_cfg.MinLeftButton);
|
|
|
|
PanelCfg_CheckBox(22, taskbar_frame.start_y + 108, 108, "Min Right Button", taskbar_cfg.MinRightButton);
|
|
|
|
win_center_x = Form.cwidth / 2;
|
|
|
|
PanelCfg_CheckBox(win_center_x, taskbar_frame.start_y + 48, 111, "Clock", taskbar_cfg.Clock);
|
|
|
|
PanelCfg_CheckBox(win_center_x, taskbar_frame.start_y + 68, 112, "Cpu Usage", taskbar_cfg.CpuUsage);
|
|
|
|
PanelCfg_CheckBox(win_center_x, taskbar_frame.start_y + 88, 113, "Change Language", taskbar_cfg.ChangeLang);
|
|
|
|
PanelCfg_CheckBox(win_center_x, taskbar_frame.start_y + 108, 114, "Menu Button", taskbar_cfg.MenuButton);
|
|
|
|
PanelCfg_MoreLessBox(22, taskbar_frame.start_y + 131, 120, 121, taskbar_cfg.PanelHeight, "Panel Height");
|
|
|
|
PanelCfg_MoreLessBox(win_center_x, taskbar_frame.start_y + 131, 122, 123, taskbar_cfg.SoftenHeight, "Soften Height");
|
|
|
|
PanelCfg_MoreLessBox(22, taskbar_frame.start_y + 159, 124, 125, taskbar_cfg.ButtonOffset, "Button Offset");
|
2015-02-25 21:38:01 +03:00
|
|
|
|
|
|
|
frame_draw stdcall (#docky_frame);
|
2015-02-26 19:48:22 +03:00
|
|
|
DefineButton(22, docky_frame.start_y + 12, panels_img.w-1, 27-1, 200 + BT_HIDE, 0);
|
|
|
|
_PutImage(22, docky_frame.start_y + 12, 37, 27, docky_cfg.location + 1 * 37 * 27 * 3 + panels_img.data);
|
2015-02-25 21:38:01 +03:00
|
|
|
WriteText(68, docky_frame.start_y + 20, 0x80, 0x333222, "Click on image to change position");
|
|
|
|
|
2015-02-26 19:48:22 +03:00
|
|
|
PanelCfg_CheckBox(22, docky_frame.start_y + 48, 201, "Full width", docky_cfg.fsize);
|
|
|
|
PanelCfg_CheckBox(win_center_x, docky_frame.start_y + 48, 202, "Always show", docky_cfg.ashow);
|
2015-02-25 21:38:01 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void LoadCfg()
|
|
|
|
{
|
2015-02-26 19:48:22 +03:00
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", 1); taskbar_cfg.Attachment = EAX;
|
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenUp", 1); taskbar_cfg.SoftenUp = EAX;
|
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenDown", 1); taskbar_cfg.SoftenDown = EAX;
|
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinLeftButton", 1); taskbar_cfg.MinLeftButton = EAX;
|
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinRightButton", 1); taskbar_cfg.MinRightButton = EAX;
|
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Clock", 1); taskbar_cfg.Clock = EAX;
|
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "CpuUsage", 1); taskbar_cfg.CpuUsage = EAX;
|
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ChangeLang", 1); taskbar_cfg.ChangeLang = EAX;
|
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MenuButton", 1); taskbar_cfg.MenuButton = EAX;
|
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "PanelHeight", 18); taskbar_cfg.PanelHeight = EAX;
|
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "SoftenHeight", 4); taskbar_cfg.SoftenHeight = EAX;
|
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonTopOffset", 3); taskbar_cfg.ButtonOffset = EAX;
|
|
|
|
ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonBotOffset", 3); taskbar_cfg.ButtonOffset = EAX;
|
2015-02-25 21:38:01 +03:00
|
|
|
|
|
|
|
ini_get_int stdcall (#docky_ini_path, "@", "location", 0); docky_cfg.location = EAX;
|
|
|
|
ini_get_int stdcall (#docky_ini_path, "@", "fsize", 0); docky_cfg.fsize = EAX;
|
|
|
|
ini_get_int stdcall (#docky_ini_path, "@", "ashow", 0); docky_cfg.ashow = EAX;
|
|
|
|
}
|
|
|
|
|
2015-02-26 19:48:22 +03:00
|
|
|
void SaveCfg(byte panel_type)
|
2015-02-25 21:38:01 +03:00
|
|
|
{
|
2015-02-26 19:48:22 +03:00
|
|
|
if (panel_type==TASKBAR) {
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", taskbar_cfg.Attachment);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenUp", taskbar_cfg.SoftenUp);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenDown", taskbar_cfg.SoftenDown);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinLeftButton", taskbar_cfg.MinLeftButton);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinRightButton", taskbar_cfg.MinRightButton);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "RunApplButton", taskbar_cfg.RunApplButton);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ClnDeskButton", taskbar_cfg.ClnDeskButton);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Clock", taskbar_cfg.Clock);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "CpuUsage", taskbar_cfg.CpuUsage);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ChangeLang", taskbar_cfg.ChangeLang);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MenuButton", taskbar_cfg.MenuButton);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "PanelHeight", taskbar_cfg.PanelHeight);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "SoftenHeight", taskbar_cfg.SoftenHeight);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonTopOffset", taskbar_cfg.ButtonOffset);
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonBottOffset", taskbar_cfg.ButtonOffset);
|
|
|
|
}
|
|
|
|
if (panel_type==DOCKY) {
|
|
|
|
ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", taskbar_cfg.Attachment);
|
|
|
|
ini_set_int stdcall (#docky_ini_path, "@", "location", docky_cfg.location);
|
|
|
|
ini_set_int stdcall (#docky_ini_path, "@", "fsize", docky_cfg.fsize);
|
|
|
|
ini_set_int stdcall (#docky_ini_path, "@", "ashow", docky_cfg.ashow);
|
|
|
|
}
|
2015-02-25 21:38:01 +03:00
|
|
|
}
|
|
|
|
|
2015-02-26 19:48:22 +03:00
|
|
|
void RestartProcess(byte panel_type)
|
2015-02-25 21:38:01 +03:00
|
|
|
{
|
2015-02-26 19:48:22 +03:00
|
|
|
int i;
|
|
|
|
dword proc_name;
|
2015-02-25 21:38:01 +03:00
|
|
|
proc_info Process;
|
2015-02-26 19:48:22 +03:00
|
|
|
if (panel_type == TASKBAR) proc_name = "@taskbar";
|
|
|
|
if (panel_type == DOCKY) proc_name = "@docky";
|
2015-02-25 21:38:01 +03:00
|
|
|
for (i=0; i<1000; i++;)
|
|
|
|
{
|
|
|
|
GetProcessInfo(#Process, i);
|
|
|
|
if (strcmpi(#Process.name, proc_name)==0) { KillProcess(Process.ID); break; }
|
|
|
|
}
|
|
|
|
RunProgram(proc_name, "");
|
|
|
|
|
2015-02-26 19:48:22 +03:00
|
|
|
if (panel_type == TASKBAR) pause(50);
|
|
|
|
if (panel_type == DOCKY) pause(120);
|
2015-02-25 21:38:01 +03:00
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
2015-02-26 19:48:22 +03:00
|
|
|
ActivateWindow(GetProcessSlot(Form.ID));
|
2015-02-25 21:38:01 +03:00
|
|
|
}
|
|
|
|
|
2015-02-26 19:48:22 +03:00
|
|
|
|
|
|
|
|
|
|
|
void PanelCfg_CheckBox(dword x, y, id, text, byte value) {
|
2015-02-25 21:38:01 +03:00
|
|
|
CheckBox(x, y, 14, 14, id, text, sc.work_graph, sc.work_text, value);
|
|
|
|
}
|
|
|
|
|
2015-02-26 19:48:22 +03:00
|
|
|
void PanelCfg_MoreLessBox(dword x, y, id_more, id_less; byte value; dword text) {
|
|
|
|
MoreLessBox(x, y, 18, id_more, id_less, sc.work_graph, sc.work_button, sc.work_button_text, value, text);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-02-25 21:38:01 +03:00
|
|
|
stop:
|