Subversion Repositories Kolibri OS

Rev

Rev 6176 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6176 Rev 6197
Line 53... Line 53...
53
	?define ASHOW "Always show"
53
	?define ASHOW "Always show"
54
	?define CHANGE_POS "Click on image to change position"
54
	?define CHANGE_POS "Click on image to change position"
55
#endif
55
#endif
Line 56... Line 56...
56
 
56
 
57
 
57
 
Line 58... Line 58...
58
frame taskbar_frame = { 0, 000, 10, 188, 14, 0x000111, 0xFFFfff, 1, TASK_FRAME_T, 0, 0, 6, 0x000111, 0xCCCccc };
58
frame taskbar_frame = { 0, NULL, 10, NULL, 16, NULL, 0xFFFfff, 1, TASK_FRAME_T, 0, 1, 12, 0x000111, 0xCCCccc };
59
frame docky_frame = { 0, 000, 10, 73, 217, 0x000111, 0xFFFfff, 1, DOCK_FRAME_T, 0, 0, 6, 0x000111, 0xCCCccc };
59
frame docky_frame   = { 0, NULL, 10, NULL, NULL, NULL, 0xFFFfff, 1, DOCK_FRAME_T, 0, 1, 12, 0x000111, 0xCCCccc };
60
 
60
 
61
char taskbar_ini_path[] = "/sys/settings/taskbar.ini";
61
char taskbar_ini_path[] = "/sys/settings/taskbar.ini";
Line 66... Line 66...
66
unsigned char panels_img_data[] = FROM "panels_image.raw";
66
unsigned char panels_img_data[] = FROM "panels_image.raw";
67
raw_image panels_img = { 37, 27, #panels_img_data };
67
raw_image panels_img = { 37, 27, #panels_img_data };
Line 68... Line 68...
68
 
68
 
Line 69... Line -...
69
proc_info Form;
-
 
70
 
69
proc_info Form;
71
struct docky_cfg {
70
 
72
	word fsize;
-
 
73
	byte location, ashow;
71
word dkFsize;
74
} docky_cfg;
-
 
75
 
-
 
76
struct taskbar_cfg {
72
byte dkLocation, dkAshow;
77
	byte Attachment;
73
 
78
	byte PanelHeight, SoftenHeight, ButtonOffset;
74
byte tbAttachment, tbPanelHeight, tbSoftenHeight, tbButtonOffset,
79
	byte SoftenUp, SoftenDown, MinLeftButton, MinRightButton, MenuButton,
-
 
Line 80... Line 75...
80
	     RunApplButton, ClnDeskButton, Clock, CpuUsage, ChangeLang;
75
     tbSoftenUp, tbSoftenDown, tbMinLeftButton, tbMinRightButton, tbMenuButton,
81
} taskbar_cfg;
76
     tbRunApplButton, tbClnDeskButton, tbClock, tbCpuUsage, tbChangeLang;
82
 
77
 
83
enum {
78
enum {
Line 102... Line 97...
102
				id=GetButtonID();
97
				id=GetButtonID();
103
				if (id==1) ExitProcess();
98
				if (id==1) ExitProcess();
104
				//taskbar buttons
99
				//taskbar buttons
105
				if (id>=100) && (id<200)
100
				if (id>=100) && (id<200)
106
				{
101
				{
107
					if (id==100) taskbar_cfg.Attachment ^= 1;
102
					if (id==100) tbAttachment ^= 1;
108
					if (id==105) taskbar_cfg.SoftenUp ^= 1;
103
					if (id==105) tbSoftenUp ^= 1;
109
					if (id==106) taskbar_cfg.SoftenDown ^= 1;
104
					if (id==106) tbSoftenDown ^= 1;
110
					if (id==107) taskbar_cfg.MinLeftButton ^= 1;
105
					if (id==107) tbMinLeftButton ^= 1;
111
					if (id==108) taskbar_cfg.MinRightButton ^= 1;
106
					if (id==108) tbMinRightButton ^= 1;
112
					if (id==109) taskbar_cfg.RunApplButton ^= 1;
107
					if (id==109) tbRunApplButton ^= 1;
113
					if (id==110) taskbar_cfg.ClnDeskButton ^= 1;
108
					if (id==110) tbClnDeskButton ^= 1;
114
					if (id==111) taskbar_cfg.Clock ^= 1;
109
					if (id==111) tbClock ^= 1;
115
					if (id==112) taskbar_cfg.CpuUsage ^= 1;
110
					if (id==112) tbCpuUsage ^= 1;
116
					if (id==113) taskbar_cfg.ChangeLang ^= 1;
111
					if (id==113) tbChangeLang ^= 1;
117
					if (id==114) taskbar_cfg.MenuButton ^= 1;
112
					if (id==114) tbMenuButton ^= 1;
118
					if (id==120) taskbar_cfg.PanelHeight++;
113
					if (id==120) tbPanelHeight++;
119
					if (id==121) && (taskbar_cfg.PanelHeight>6) taskbar_cfg.PanelHeight--;
114
					if (id==121) && (tbPanelHeight>6) tbPanelHeight--;
120
					if (id==122) taskbar_cfg.SoftenHeight++;
115
					if (id==122) tbSoftenHeight++;
121
					if (id==123) && (taskbar_cfg.SoftenHeight>0) taskbar_cfg.SoftenHeight--;
116
					if (id==123) && (tbSoftenHeight>0) tbSoftenHeight--;
122
					if (id==124) taskbar_cfg.ButtonOffset++;
117
					if (id==124) tbButtonOffset++;
123
					if (id==125) && (taskbar_cfg.ButtonOffset>0) taskbar_cfg.ButtonOffset--;
118
					if (id==125) && (tbButtonOffset>0) tbButtonOffset--;
124
					DrawWindowContent(TASKBAR);
119
					DrawWindowContent(TASKBAR);
125
					SaveCfg(TASKBAR);
120
					SaveCfg(TASKBAR);
126
					RestartProcess(TASKBAR);
121
					RestartProcess(TASKBAR);
127
				}
122
				}
128
				//docky buttons			
123
				//docky buttons			
129
				if (id>=200)
124
				if (id>=200)
130
				{
125
				{
131
					if (id==200)
126
					if (id==200)
132
					{
127
					{
133
						     if (docky_cfg.location==1) docky_cfg.location = 2;
-
 
134
						else if (docky_cfg.location==2) docky_cfg.location = 3;
128
						dkLocation++;
135
						else if (docky_cfg.location==3) docky_cfg.location = 1;
129
						if (dkLocation>3) dkLocation=1;
136
					}
130
					}
137
					if (id==201) docky_cfg.fsize ^= 1;
131
					if (id==201) dkFsize ^= 1;
138
					if (id==202) docky_cfg.ashow ^= 1;
132
					if (id==202) dkAshow ^= 1;
139
					DrawWindowContent(DOCKY);
133
					DrawWindowContent(DOCKY);
140
					SaveCfg(DOCKY);
134
					SaveCfg(DOCKY);
141
					RestartProcess(DOCKY);
135
					RestartProcess(DOCKY);
142
				}
136
				}
143
				break;
137
				break;
Line 147... Line 141...
147
				if (key==27) ExitProcess();
141
				if (key==27) ExitProcess();
148
				break;
142
				break;
Line 149... Line 143...
149
			
143
			
150
		case evReDraw:
144
		case evReDraw:
151
				system.color.get();
145
				system.color.get();
152
				DefineAndDrawWindow(130, 150, 400, 300+GetSkinHeight(),0x34,system.color.work,WINDOW_TITLE);
146
				DefineAndDrawWindow(130, 150, 465, 398+GetSkinHeight(),0x34,system.color.work,WINDOW_TITLE);
153
				GetProcessInfo(#Form, SelfInfo);
147
				GetProcessInfo(#Form, SelfInfo);
154
				if (Form.status_window>2) break;
148
				if (Form.status_window>2) break;
155
				taskbar_frame.size_x = docky_frame.size_x = - taskbar_frame.start_x * 2 + Form.cwidth;
149
				taskbar_frame.size_x = docky_frame.size_x = - taskbar_frame.start_x * 2 + Form.cwidth;
156
				taskbar_frame.font_color = docky_frame.font_color = system.color.work_text;
150
				taskbar_frame.font_color = docky_frame.font_color = system.color.work_text;
Line 161... Line 155...
161
}
155
}
Line 162... Line 156...
162
 
156
 
163
 
157
 
164
void DrawWindowContent(byte panel_type)
158
void DrawWindowContent(byte panel_type)
-
 
159
{
Line 165... Line -...
165
{
-
 
166
	word win_center_x;
-
 
167
 
-
 
168
	if (panel_type==ALL)
-
 
169
	{
-
 
170
		frame_draw stdcall (#taskbar_frame);
160
	word win_center_x = Form.cwidth / 2 + 20;
171
		frame_draw stdcall (#docky_frame);
161
	incn y;
-
 
162
 
172
	}
163
	if (panel_type==ALL) || (panel_type==TASKBAR)
173
	if (panel_type==ALL) || (panel_type==TASKBAR)
164
	{
174
	{
165
		y.n = taskbar_frame.start_y;
175
		DefineButton(22, taskbar_frame.start_y + 12, panels_img.w-1, 27-1, 100 + BT_HIDE, 0);
166
		DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 100 + BT_HIDE, 0);
176
		_PutImage(22, taskbar_frame.start_y + 12,  37, 27, taskbar_cfg.Attachment * 37 * 27 * 3 + panels_img.data);
167
		_PutImage(22, y.n, 37, 27, tbAttachment * 37 * 27 * 3 + panels_img.data);
177
		WriteText(68, taskbar_frame.start_y + 20, 0x80, system.color.work_text, CHANGE_POS);
168
		WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
178
		CheckBox(22, taskbar_frame.start_y +  48, 105, SOFTEN_UP, taskbar_cfg.SoftenUp);
169
		CheckBox(22, y.inc(35), 105, SOFTEN_UP, tbSoftenUp);
179
		CheckBox(22, taskbar_frame.start_y +  68, 106, SOFTEN_DOWN, taskbar_cfg.SoftenDown);
-
 
180
		CheckBox(22, taskbar_frame.start_y +  88, 107, MIN_LEFT_BUTTON, taskbar_cfg.MinLeftButton);
170
		CheckBox(win_center_x, y.n, 111, CLOCK, tbClock);
181
		CheckBox(22, taskbar_frame.start_y + 108, 108, MIN_RIGHT_BUTTON, taskbar_cfg.MinRightButton);
171
		CheckBox(22, y.inc(24), 106, SOFTEN_DOWN, tbSoftenDown);
182
		win_center_x = Form.cwidth / 2;
172
		CheckBox(win_center_x, y.n, 112, CPU_USAGE, tbCpuUsage);
183
		CheckBox(win_center_x, taskbar_frame.start_y +  48, 111, CLOCK, taskbar_cfg.Clock);
173
		CheckBox(22, y.inc(24), 107, MIN_LEFT_BUTTON, tbMinLeftButton);
184
		CheckBox(win_center_x, taskbar_frame.start_y +  68, 112, CPU_USAGE, taskbar_cfg.CpuUsage);
174
		CheckBox(win_center_x, y.n, 113, CHANGE_LANG, tbChangeLang);
185
		CheckBox(win_center_x, taskbar_frame.start_y +  88, 113, CHANGE_LANG, taskbar_cfg.ChangeLang);
175
		CheckBox(22, y.inc(24), 108, MIN_RIGHT_BUTTON, tbMinRightButton);
186
		CheckBox(win_center_x, taskbar_frame.start_y + 108, 114, MENU_BUTTON, taskbar_cfg.MenuButton);	
176
		CheckBox(win_center_x, y.n, 114, MENU_BUTTON, tbMenuButton);	
-
 
177
		MoreLessBox(22, y.inc(28), 120, 121, tbPanelHeight, PANEL_HEIGHT);
187
		MoreLessBox(22, taskbar_frame.start_y + 131, 120, 121, taskbar_cfg.PanelHeight, PANEL_HEIGHT);
178
		MoreLessBox(22, y.inc(32), 122, 123, tbSoftenHeight, SOFTEN_HEIGHT);
188
		MoreLessBox(win_center_x, taskbar_frame.start_y + 131, 122, 123, taskbar_cfg.SoftenHeight, SOFTEN_HEIGHT);
179
		MoreLessBox(22, y.inc(32), 124, 125, tbButtonOffset, BUTTON_OFFSET);
189
		MoreLessBox(22, taskbar_frame.start_y + 159, 124, 125, taskbar_cfg.ButtonOffset, BUTTON_OFFSET);
180
		taskbar_frame.size_y = y.inc(32) - taskbar_frame.start_y;
-
 
181
	}
190
	}
182
	if (panel_type==ALL) || (panel_type==DOCKY)
191
	if (panel_type==ALL) || (panel_type==DOCKY)
183
	{
192
	{
184
		docky_frame.start_y = y.inc(20);
193
		DefineButton(22, docky_frame.start_y + 12, panels_img.w-1, 27-1, 200 + BT_HIDE, 0);
185
		DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 200 + BT_HIDE, 0);
194
		_PutImage(22, docky_frame.start_y + 12,  37, 27, docky_cfg.location + 1 * 37 * 27 * 3 + panels_img.data);
186
		_PutImage(22, y.n,  37, 27, dkLocation + 1 * 37 * 27 * 3 + panels_img.data);
-
 
187
		WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
-
 
188
		CheckBox(22, y.inc(35), 201, FSIZE,  dkFsize);
-
 
189
		CheckBox(win_center_x, y.n, 202, ASHOW, dkAshow);
-
 
190
		docky_frame.size_y = y.inc(30) - docky_frame.start_y;
-
 
191
	}
-
 
192
	if (panel_type==ALL)
195
		WriteText(68, docky_frame.start_y + 20, 0x80, system.color.work_text, CHANGE_POS);
193
	{
196
		CheckBox(22, docky_frame.start_y + 48, 201, FSIZE,  docky_cfg.fsize);
194
		frame_draw stdcall (#taskbar_frame);
Line 197... Line 195...
197
		CheckBox(win_center_x, docky_frame.start_y + 48, 202, ASHOW, docky_cfg.ashow);
195
		frame_draw stdcall (#docky_frame);
198
	}
196
	}
199
}
197
}
200
 
198
 
201
void LoadCfg()
199
void LoadCfg()
202
{ 
200
{ 
203
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", 1);     taskbar_cfg.Attachment = EAX;
201
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", 1);     tbAttachment = EAX;
204
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenUp", 1);       taskbar_cfg.SoftenUp = EAX;
202
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenUp", 1);       tbSoftenUp = EAX;
205
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenDown", 1);     taskbar_cfg.SoftenDown = EAX;
203
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenDown", 1);     tbSoftenDown = EAX;
206
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinLeftButton", 1);  taskbar_cfg.MinLeftButton = EAX;
204
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinLeftButton", 1);  tbMinLeftButton = EAX;
207
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinRightButton", 1); taskbar_cfg.MinRightButton = EAX;
205
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinRightButton", 1); tbMinRightButton = EAX;
208
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Clock", 1);          taskbar_cfg.Clock = EAX;
206
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Clock", 1);          tbClock = EAX;
209
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "CpuUsage", 1);       taskbar_cfg.CpuUsage = EAX;
207
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "CpuUsage", 1);       tbCpuUsage = EAX;
210
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ChangeLang", 1);     taskbar_cfg.ChangeLang = EAX;
208
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ChangeLang", 1);     tbChangeLang = EAX;
211
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MenuButton", 1);     taskbar_cfg.MenuButton = EAX;
209
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MenuButton", 1);     tbMenuButton = EAX;
212
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "PanelHeight", 18);    taskbar_cfg.PanelHeight = EAX;
210
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "PanelHeight", 18);    tbPanelHeight = EAX;
213
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "SoftenHeight", 4);    taskbar_cfg.SoftenHeight = EAX;
211
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "SoftenHeight", 4);    tbSoftenHeight = EAX;
214
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonTopOffset", 3); taskbar_cfg.ButtonOffset = EAX;
212
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonTopOffset", 3); tbButtonOffset = EAX;
215
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonBotOffset", 3); taskbar_cfg.ButtonOffset = EAX;
213
	ini_get_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonBotOffset", 3); tbButtonOffset = EAX;
216
 
214
 
Line 217... Line 215...
217
	ini_get_int stdcall (#docky_ini_path, "@", "location", 0);  docky_cfg.location = EAX;
215
	ini_get_int stdcall (#docky_ini_path, "@", "location", 0);  dkLocation = EAX;
218
	ini_get_int stdcall (#docky_ini_path, "@", "fsize", 0);     docky_cfg.fsize = EAX;
216
	ini_get_int stdcall (#docky_ini_path, "@", "fsize", 0);     dkFsize = EAX;
219
	ini_get_int stdcall (#docky_ini_path, "@", "ashow", 0);     docky_cfg.ashow = EAX;
217
	ini_get_int stdcall (#docky_ini_path, "@", "ashow", 0);     dkAshow = EAX;
220
}
218
}
221
 
219
 
222
void SaveCfg(byte panel_type)
220
void SaveCfg(byte panel_type)
223
{
221
{
224
	if (panel_type==TASKBAR) {
222
	if (panel_type==TASKBAR) {
225
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", taskbar_cfg.Attachment);
223
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", tbAttachment);
226
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenUp", taskbar_cfg.SoftenUp);
224
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenUp", tbSoftenUp);
227
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenDown", taskbar_cfg.SoftenDown);
225
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "SoftenDown", tbSoftenDown);
228
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinLeftButton", taskbar_cfg.MinLeftButton);
226
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinLeftButton", tbMinLeftButton);
229
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinRightButton", taskbar_cfg.MinRightButton);
227
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MinRightButton", tbMinRightButton);
230
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "RunApplButton", taskbar_cfg.RunApplButton);
228
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "RunApplButton", tbRunApplButton);
231
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ClnDeskButton", taskbar_cfg.ClnDeskButton);
229
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ClnDeskButton", tbClnDeskButton);
232
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Clock", taskbar_cfg.Clock);
230
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Clock", tbClock);
233
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "CpuUsage", taskbar_cfg.CpuUsage);
231
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "CpuUsage", tbCpuUsage);
234
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ChangeLang", taskbar_cfg.ChangeLang);
232
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "ChangeLang", tbChangeLang);
235
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MenuButton", taskbar_cfg.MenuButton);
233
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "MenuButton", tbMenuButton);
236
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "PanelHeight", taskbar_cfg.PanelHeight);
234
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "PanelHeight", tbPanelHeight);
237
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "SoftenHeight", taskbar_cfg.SoftenHeight);
235
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "SoftenHeight", tbSoftenHeight);
238
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonTopOffset", taskbar_cfg.ButtonOffset);
236
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonTopOffset", tbButtonOffset);
239
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonBottOffset", taskbar_cfg.ButtonOffset);
237
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_variables, "ButtonBottOffset", tbButtonOffset);
240
	}
238
	}
241
	if (panel_type==DOCKY) {
239
	if (panel_type==DOCKY) {
242
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", taskbar_cfg.Attachment);
240
		ini_set_int stdcall (#taskbar_ini_path, #taskbar_c_flags, "Attachment", tbAttachment);
Line 243... Line 241...
243
		ini_set_int stdcall (#docky_ini_path, "@", "location", docky_cfg.location);
241
		ini_set_int stdcall (#docky_ini_path, "@", "location", dkLocation);
244
		ini_set_int stdcall (#docky_ini_path, "@", "fsize", docky_cfg.fsize);
242
		ini_set_int stdcall (#docky_ini_path, "@", "fsize", dkFsize);