Subversion Repositories Kolibri OS

Rev

Rev 5477 | Go to most recent revision | Details | Compare with Previous | 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\libini.h"
11
#include "..\lib\lib.obj\box_lib.h"
12
13
 
14
15
 
5479 leency 16
5472 leency 17
 
5477 leency 18
frame docky_frame = { 0, 000, 10, 73, 217, 0x000111, 0xFFFfff, 1, " Docky ", 0, 0, 6, 0x000111, 0xCCCccc };
19
5472 leency 20
 
21
char taskbar_c_flags[] = "Flags";
5477 leency 22
char taskbar_c_variables[] = "Variables";
23
char docky_ini_path[] = "/sys/settings/docky.ini";
5472 leency 24
25
 
5477 leency 26
raw_image panels_img = { 37, 27, #panels_img_data };
27
5472 leency 28
 
29
proc_info Form;
30
31
 
32
	word fsize;
33
	byte location, ashow;
34
} docky_cfg;
35
36
 
37
	byte Attachment;
38
	byte PanelHeight, SoftenHeight, ButtonOffset;
5477 leency 39
	byte SoftenUp, SoftenDown, MinLeftButton, MinRightButton, MenuButton,
5472 leency 40
	     RunApplButton, ClnDeskButton, Clock, CpuUsage, ChangeLang;
41
} taskbar_cfg;
42
43
 
5477 leency 44
	TASKBAR,
45
	DOCKY
46
};
47
5472 leency 48
 
49
 
50
{
51
	dword id, key;
52
53
 
54
	if (load_dll2(libini, #lib_init,1)!=0) notify("Error: library doesn't exists - libini");
55
	if (load_dll2(boxlib, #box_lib_init,0)!=0) notify("Eror: library doesn't exists - boxlib");
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
					if (id==120) taskbar_cfg.PanelHeight++;
5477 leency 79
					if (id==121) && (taskbar_cfg.PanelHeight>6) taskbar_cfg.PanelHeight--;
80
					if (id==122) taskbar_cfg.SoftenHeight++;
81
					if (id==123) && (taskbar_cfg.SoftenHeight>0) taskbar_cfg.SoftenHeight--;
82
					if (id==124) taskbar_cfg.ButtonOffset++;
83
					if (id==125) && (taskbar_cfg.ButtonOffset>0) taskbar_cfg.ButtonOffset--;
84
					DrawWindowContent(TASKBAR);
85
					SaveCfg(TASKBAR);
86
					RestartProcess(TASKBAR);
87
				}
5472 leency 88
				//docky buttons
89
				if (id>=200)
90
				{
91
					if (id==200)
92
					{
93
						     if (docky_cfg.location==1) docky_cfg.location = 2;
94
						else if (docky_cfg.location==2) docky_cfg.location = 3;
95
						else if (docky_cfg.location==3) docky_cfg.location = 1;
96
					}
97
					if (id==201) docky_cfg.fsize ^= 1;
98
					if (id==202) docky_cfg.ashow ^= 1;
99
					DrawWindowContent(DOCKY);
5477 leency 100
					SaveCfg(DOCKY);
101
					RestartProcess(DOCKY);
102
				}
5472 leency 103
				break;
104
105
 
106
				key = GetKey();
107
				if (key==27) ExitProcess();
108
				break;
109
110
 
111
				sc.get();
112
				DefineAndDrawWindow(130, 150, 390, 300+GetSkinHeight(),0x34,sc.work,WINDOW_TITLE);
5477 leency 113
				GetProcessInfo(#Form, SelfInfo);
5472 leency 114
				if (Form.status_window>2) break;
115
				taskbar_frame.size_x = docky_frame.size_x = - taskbar_frame.start_x * 2 + Form.cwidth;
116
				taskbar_frame.font_color = docky_frame.font_color = sc.work_text;
117
				taskbar_frame.font_backgr_color = docky_frame.font_backgr_color = sc.work;
118
				taskbar_frame.ext_col = docky_frame.ext_col = sc.work_graph;
5477 leency 119
				DrawWindowContent();
5472 leency 120
	}
121
}
122
123
 
124
 
125
{
126
	word win_center_x;
127
128
 
129
	DefineButton(22, taskbar_frame.start_y + 12, panels_img.w-1, 27-1, 100 + BT_HIDE, 0);
5477 leency 130
	_PutImage(22, taskbar_frame.start_y + 12,  37, 27, taskbar_cfg.Attachment * 37 * 27 * 3 + panels_img.data);
131
	WriteText(68, taskbar_frame.start_y + 20, 0x80, 0x333222, "Click on image to change position");
5472 leency 132
	PanelCfg_CheckBox(22, taskbar_frame.start_y +  48, 105, "Soften Up", taskbar_cfg.SoftenUp);
5477 leency 133
	PanelCfg_CheckBox(22, taskbar_frame.start_y +  68, 106, "Soften Down", taskbar_cfg.SoftenDown);
134
	PanelCfg_CheckBox(22, taskbar_frame.start_y +  88, 107, "Min Left Button", taskbar_cfg.MinLeftButton);
135
	PanelCfg_CheckBox(22, taskbar_frame.start_y + 108, 108, "Min Right Button", taskbar_cfg.MinRightButton);
136
	win_center_x = Form.cwidth / 2;
137
	PanelCfg_CheckBox(win_center_x, taskbar_frame.start_y +  48, 111, "Clock", taskbar_cfg.Clock);
138
	PanelCfg_CheckBox(win_center_x, taskbar_frame.start_y +  68, 112, "Cpu Usage", taskbar_cfg.CpuUsage);
139
	PanelCfg_CheckBox(win_center_x, taskbar_frame.start_y +  88, 113, "Change Language", taskbar_cfg.ChangeLang);
140
	PanelCfg_CheckBox(win_center_x, taskbar_frame.start_y + 108, 114, "Menu Button", taskbar_cfg.MenuButton);
141
	PanelCfg_MoreLessBox(22, taskbar_frame.start_y + 131, 120, 121, taskbar_cfg.PanelHeight, "Panel Height");
142
	PanelCfg_MoreLessBox(win_center_x, taskbar_frame.start_y + 131, 122, 123, taskbar_cfg.SoftenHeight, "Soften Height");
143
	PanelCfg_MoreLessBox(22, taskbar_frame.start_y + 159, 124, 125, taskbar_cfg.ButtonOffset, "Button Offset");
144
5472 leency 145
 
146
	DefineButton(22, docky_frame.start_y + 12, panels_img.w-1, 27-1, 200 + BT_HIDE, 0);
5477 leency 147
	_PutImage(22, docky_frame.start_y + 12,  37, 27, docky_cfg.location + 1 * 37 * 27 * 3 + panels_img.data);
148
	WriteText(68, docky_frame.start_y + 20, 0x80, 0x333222, "Click on image to change position");
5472 leency 149
150
 
5477 leency 151
	PanelCfg_CheckBox(win_center_x, docky_frame.start_y + 48, 202, "Always show", docky_cfg.ashow);
152
}
5472 leency 153
154
 
155
{
156
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", 1);     taskbar_cfg.Attachment = EAX;
5477 leency 157
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenUp", 1);       taskbar_cfg.SoftenUp = EAX;
158
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenDown", 1);     taskbar_cfg.SoftenDown = EAX;
159
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinLeftButton", 1);  taskbar_cfg.MinLeftButton = EAX;
160
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinRightButton", 1); taskbar_cfg.MinRightButton = EAX;
161
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Clock", 1);          taskbar_cfg.Clock = EAX;
162
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "CpuUsage", 1);       taskbar_cfg.CpuUsage = EAX;
163
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ChangeLang", 1);     taskbar_cfg.ChangeLang = EAX;
164
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MenuButton", 1);     taskbar_cfg.MenuButton = EAX;
165
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "PanelHeight", 18);    taskbar_cfg.PanelHeight = EAX;
166
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "SoftenHeight", 4);    taskbar_cfg.SoftenHeight = EAX;
167
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonTopOffset", 3); taskbar_cfg.ButtonOffset = EAX;
168
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonBotOffset", 3); taskbar_cfg.ButtonOffset = EAX;
169
5472 leency 170
 
171
	ini_get_int stdcall (#docky_ini_path, "@", "fsize", 0);     docky_cfg.fsize = EAX;
172
	ini_get_int stdcall (#docky_ini_path, "@", "ashow", 0);     docky_cfg.ashow = EAX;
173
}
174
175
 
5477 leency 176
{
5472 leency 177
	if (panel_type==TASKBAR) {
5477 leency 178
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", taskbar_cfg.Attachment);
179
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenUp", taskbar_cfg.SoftenUp);
180
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenDown", taskbar_cfg.SoftenDown);
181
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinLeftButton", taskbar_cfg.MinLeftButton);
182
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinRightButton", taskbar_cfg.MinRightButton);
183
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "RunApplButton", taskbar_cfg.RunApplButton);
184
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ClnDeskButton", taskbar_cfg.ClnDeskButton);
185
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Clock", taskbar_cfg.Clock);
186
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "CpuUsage", taskbar_cfg.CpuUsage);
187
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ChangeLang", taskbar_cfg.ChangeLang);
188
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MenuButton", taskbar_cfg.MenuButton);
189
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "PanelHeight", taskbar_cfg.PanelHeight);
190
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "SoftenHeight", taskbar_cfg.SoftenHeight);
191
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonTopOffset", taskbar_cfg.ButtonOffset);
192
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonBottOffset", taskbar_cfg.ButtonOffset);
193
	}
194
	if (panel_type==DOCKY) {
195
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", taskbar_cfg.Attachment);
196
		ini_set_int stdcall (#docky_ini_path, "@", "location", docky_cfg.location);
197
		ini_set_int stdcall (#docky_ini_path, "@", "fsize", docky_cfg.fsize);
198
		ini_set_int stdcall (#docky_ini_path, "@", "ashow", docky_cfg.ashow);
199
	}
200
}
5472 leency 201
202
 
5477 leency 203
{
5472 leency 204
	int i;
5477 leency 205
	dword proc_name;
206
	proc_info Process;
5472 leency 207
	if (panel_type == TASKBAR) proc_name = "@taskbar";
5477 leency 208
	if (panel_type == DOCKY) proc_name = "@docky";
209
	for (i=0; i<1000; i++;)
5472 leency 210
	{
211
		GetProcessInfo(#Process, i);
212
		if (strcmpi(#Process.name, proc_name)==0) { KillProcess(Process.ID); break; }
213
	}
214
	RunProgram(proc_name, "");
215
216
 
5477 leency 217
	if (panel_type == DOCKY) pause(120);
218
	GetProcessInfo(#Form, SelfInfo);
5472 leency 219
	ActivateWindow(GetProcessSlot(Form.ID));
5477 leency 220
}
5472 leency 221
222
 
5477 leency 223
 
224
 
225
	CheckBox(x, y, 14, 14, id, text, sc.work_graph, sc.work_text, value);
5472 leency 226
}
227
228
 
5477 leency 229
	MoreLessBox(x, y, 18, id_more, id_less, sc.work_graph, sc.work_button, sc.work_button_text, value, text);
230
}
231
232
 
233
 
5472 leency 234
>