Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5472 leency 1
 
2
#include "..\lib\kolibri.h"
3
#include "..\lib\strings.h"
4
#include "..\lib\mem.h"
5
#include "..\lib\file_system.h"
6
#include "..\lib\dll.h"
7
#include "..\lib\figures.h"
8
9
 
10
#include "..\lib\lib.obj\libimg_lib.h"
11
#include "..\lib\lib.obj\libini.h"
12
#include "..\lib\lib.obj\box_lib.h"
13
14
 
15
16
 
17
18
 
19
frame docky_frame = { 0, 100, 10, 98, 183, 0x000111, 0xFFFfff, 1, " Docky ", 0, 0, 6, 0x000111, 0xCCCccc };
20
21
 
22
char taskbar_category[] = "Flags";
23
char docky_ini_path[] = "/sys/settings/docky.ini";
24
25
 
26
 
27
proc_info Form;
28
mouse m;
29
libimg_image panels_image;
30
31
 
32
	word fsize;
33
	byte location, ashow;
34
} docky_cfg;
35
36
 
37
	byte Attachment;
38
	byte PanelHeigh;
39
	byte SoftenUp, SoftenDown, MinLeftButton, MinRightButton, MenuButton,
40
	     RunApplButton, ClnDeskButton, Clock, CpuUsage, ChangeLang;
41
} taskbar_cfg;
42
43
 
44
 
45
 
46
{
47
	dword id, key;
48
49
 
50
	if (load_dll2(libio,  #libio_init,1)!=0) notify("Error: library doesn't exists - libio");
51
	if (load_dll2(libimg, #libimg_init,1)!=0) notify("Error: library doesn't exists - libimg");
52
	if (load_dll2(libini, #lib_init,1)!=0) notify("Error: library doesn't exists - libini");
53
	if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Eror: library doesn't exists - boxlib");
54
55
 
56
57
 
58
59
 
60
	{
61
		case evButton:
62
				id=GetButtonID();
63
				if (id==1) ExitProcess();
64
				//taskbar buttons
65
				if (id>=100) && (id<200)
66
				{
67
					if (id==100) taskbar_cfg.Attachment ^= 1;
68
					if (id==105) taskbar_cfg.SoftenUp ^= 1;
69
					if (id==106) taskbar_cfg.SoftenDown ^= 1;
70
					if (id==107) taskbar_cfg.MinLeftButton ^= 1;
71
					if (id==108) taskbar_cfg.MinRightButton ^= 1;
72
					if (id==109) taskbar_cfg.RunApplButton ^= 1;
73
					if (id==110) taskbar_cfg.ClnDeskButton ^= 1;
74
					if (id==111) taskbar_cfg.Clock ^= 1;
75
					if (id==112) taskbar_cfg.CpuUsage ^= 1;
76
					if (id==113) taskbar_cfg.ChangeLang ^= 1;
77
					if (id==114) taskbar_cfg.MenuButton ^= 1;
78
					DrawWindowContent();
79
					SaveCfg();
80
					RestartProcess("@taskbar");
81
				}
82
				//docky buttons
83
				if (id>=200)
84
				{
85
					if (id==200)
86
					{
87
						     if (docky_cfg.location==1) docky_cfg.location = 2;
88
						else if (docky_cfg.location==2) docky_cfg.location = 3;
89
						else if (docky_cfg.location==3) docky_cfg.location = 1;
90
					}
91
					if (id==201) docky_cfg.fsize ^= 1;
92
					if (id==202) docky_cfg.ashow ^= 1;
93
					DrawWindowContent();
94
					SaveCfg();
95
					RestartProcess("@docky");
96
				}
97
				break;
98
99
 
100
				key = GetKey();
101
				if (key==27) ExitProcess();
102
				break;
103
104
 
105
				sc.get();
106
				DefineAndDrawWindow(130, 150, 400, 300+GetSkinHeight(),0x34,sc.work,WINDOW_TITLE);
107
				GetProcessInfo(#Form, SelfInfo);
108
				if (Form.status_window>2) break;
109
				taskbar_frame.size_x = docky_frame.size_x = - taskbar_frame.start_x * 2 + Form.cwidth;
110
				taskbar_frame.font_color = docky_frame.font_color = sc.work_text;
111
				taskbar_frame.font_backgr_color = docky_frame.font_backgr_color = sc.work;
112
				DrawWindowContent();
113
	}
114
}
115
116
 
117
 
118
{
119
	word win_center_x;
120
121
 
122
	DefineButton(22, taskbar_frame.start_y + 12, panels_image.w-1, 27-1, 100 + BT_HIDE, 0);
123
	img_draw stdcall(panels_image.image, 22, taskbar_frame.start_y + 12, panels_image.w, 27, 0, taskbar_cfg.Attachment * 27);
124
	WriteText(68, taskbar_frame.start_y + 20, 0x80, 0x333222, "Click on image to change position");
125
	PanelCfgCheckBox(22, taskbar_frame.start_y +  48, 105, "Soften Up", taskbar_cfg.SoftenUp);
126
	PanelCfgCheckBox(22, taskbar_frame.start_y +  68, 106, "Soften Down", taskbar_cfg.SoftenDown);
127
	PanelCfgCheckBox(22, taskbar_frame.start_y +  88, 107, "Min Left Button", taskbar_cfg.MinLeftButton);
128
	PanelCfgCheckBox(22, taskbar_frame.start_y + 108, 108, "Min Right Button", taskbar_cfg.MinRightButton);
129
	PanelCfgCheckBox(22, taskbar_frame.start_y + 128, 109, "Run Application Button", taskbar_cfg.RunApplButton);
130
	win_center_x = Form.cwidth * 55 / 100;
131
	PanelCfgCheckBox(win_center_x, taskbar_frame.start_y +  48, 110, "ClnDeskButton - wtf?", taskbar_cfg.ClnDeskButton);
132
	PanelCfgCheckBox(win_center_x, taskbar_frame.start_y +  68, 111, "Clock", taskbar_cfg.Clock);
133
	PanelCfgCheckBox(win_center_x, taskbar_frame.start_y +  88, 112, "Cpu Usage", taskbar_cfg.CpuUsage);
134
	PanelCfgCheckBox(win_center_x, taskbar_frame.start_y + 108, 113, "Change Language", taskbar_cfg.ChangeLang);
135
	PanelCfgCheckBox(win_center_x, taskbar_frame.start_y + 128, 114, "Menu Button", taskbar_cfg.MenuButton);
136
	//PanelCfgCheckBox(22, taskbar_frame.start_y + 64, 204, "111", taskbar_cfg.PanelHeigh);
137
138
 
139
	DefineButton(22, docky_frame.start_y + 12, panels_image.w-1, 27-1, 200 + BT_HIDE, 0);
140
	img_draw stdcall(panels_image.image, 22, docky_frame.start_y + 12, panels_image.w, 27, 0, docky_cfg.location * 27 + 27);
141
	WriteText(68, docky_frame.start_y + 20, 0x80, 0x333222, "Click on image to change position");
142
143
 
144
	PanelCfgCheckBox(22, docky_frame.start_y + 70, 202, "Always show", docky_cfg.ashow);
145
}
146
147
 
148
{
149
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_category, "Attachment", 1);     taskbar_cfg.Attachment = EAX;
150
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_category, "PanelHeigh", 18);    taskbar_cfg.PanelHeigh = EAX;
151
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_category, "SoftenUp", 1);       taskbar_cfg.SoftenUp = EAX;
152
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_category, "SoftenDown", 1);     taskbar_cfg.SoftenDown = EAX;
153
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_category, "MinLeftButton", 1);  taskbar_cfg.MinLeftButton = EAX;
154
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_category, "MinRightButton", 1); taskbar_cfg.MinRightButton = EAX;
155
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_category, "RunApplButton", 1);  taskbar_cfg.RunApplButton = EAX;
156
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_category, "ClnDeskButton", 1);  taskbar_cfg.ClnDeskButton = EAX;
157
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_category, "Clock", 1);          taskbar_cfg.Clock = EAX;
158
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_category, "CpuUsage", 1);       taskbar_cfg.CpuUsage = EAX;
159
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_category, "ChangeLang", 1);     taskbar_cfg.ChangeLang = EAX;
160
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_category, "MenuButton", 1);     taskbar_cfg.MenuButton = EAX;
161
162
 
163
	ini_get_int stdcall (#docky_ini_path, "@", "fsize", 0);     docky_cfg.fsize = EAX;
164
	ini_get_int stdcall (#docky_ini_path, "@", "ashow", 0);     docky_cfg.ashow = EAX;
165
}
166
167
 
168
{
169
	ini_set_int stdcall (#taskbar_ini_path, #taskbar_category, "Attachment", taskbar_cfg.Attachment);
170
	ini_set_int stdcall (#taskbar_ini_path, #taskbar_category, "PanelHeigh", taskbar_cfg.PanelHeigh);
171
	ini_set_int stdcall (#taskbar_ini_path, #taskbar_category, "SoftenUp", taskbar_cfg.SoftenUp);
172
	ini_set_int stdcall (#taskbar_ini_path, #taskbar_category, "SoftenDown", taskbar_cfg.SoftenDown);
173
	ini_set_int stdcall (#taskbar_ini_path, #taskbar_category, "MinLeftButton", taskbar_cfg.MinLeftButton);
174
	ini_set_int stdcall (#taskbar_ini_path, #taskbar_category, "MinRightButton", taskbar_cfg.MinRightButton);
175
	ini_set_int stdcall (#taskbar_ini_path, #taskbar_category, "RunApplButton", taskbar_cfg.RunApplButton);
176
	ini_set_int stdcall (#taskbar_ini_path, #taskbar_category, "ClnDeskButton", taskbar_cfg.ClnDeskButton);
177
	ini_set_int stdcall (#taskbar_ini_path, #taskbar_category, "Clock", taskbar_cfg.Clock);
178
	ini_set_int stdcall (#taskbar_ini_path, #taskbar_category, "CpuUsage", taskbar_cfg.CpuUsage);
179
	ini_set_int stdcall (#taskbar_ini_path, #taskbar_category, "ChangeLang", taskbar_cfg.ChangeLang);
180
	ini_set_int stdcall (#taskbar_ini_path, #taskbar_category, "MenuButton", taskbar_cfg.MenuButton);
181
182
 
183
	ini_set_int stdcall (#docky_ini_path, "@", "location", docky_cfg.location);
184
	ini_set_int stdcall (#docky_ini_path, "@", "fsize", docky_cfg.fsize);
185
	ini_set_int stdcall (#docky_ini_path, "@", "ashow", docky_cfg.ashow);
186
}
187
188
 
189
{
190
	int i, slot;
191
	proc_info Process;
192
	for (i=0; i<1000; i++;)
193
	{
194
		GetProcessInfo(#Process, i);
195
		if (strcmpi(#Process.name, proc_name)==0) { KillProcess(Process.ID); break; }
196
	}
197
	RunProgram(proc_name, "");
198
199
 
200
	GetProcessInfo(#Form, SelfInfo);
201
	slot = GetProcessSlot(Form.ID);
202
	ActivateWindow(slot);
203
}
204
205
 
206
	CheckBox(x, y, 14, 14, id, text, sc.work_graph, sc.work_text, value);
207
}
208
209
 
210
>