Subversion Repositories Kolibri OS

Rev

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

Rev 7243 Rev 7244
Line 63... Line 63...
63
unsigned char panels_img_data[] = FROM "panels_image.raw";
63
unsigned char panels_img_data[] = FROM "panels_image.raw";
64
raw_image panels_img = { 37, 27, #panels_img_data };
64
raw_image panels_img = { 37, 27, #panels_img_data };
Line 65... Line 65...
65
 
65
 
Line 66... Line -...
66
proc_info Form;
-
 
67
 
-
 
68
word dkFsize;
-
 
69
byte dkLocation, dkAshow;
-
 
70
 
66
proc_info Form;
71
byte tbAttachment, tbSoftenUp, tbSoftenDown, tbMinLeftButton, tbMinRightButton,
-
 
72
tbMenuButton, tbRunApplButton, tbClnDeskButton, tbClock, tbCpuUsage, tbChangeLang;
-
 
73
 
67
 
74
enum {
-
 
75
	TASKBAR,
-
 
76
	DOCKY,
-
 
Line 77... Line 68...
77
	ALL
68
enum { BTN_TB_ATTACHEMENT=100, BTN_DOCKY_ATTACHEMENT=200 };
78
};
69
enum { TASKBAR, DOCKY };
79
 
70
 
Line -... Line 71...
-
 
71
more_less_box tbPanelHeight  = { NULL, 6, 99, PANEL_HEIGHT };
-
 
72
more_less_box tbSoftenHeight = { NULL, 0, 99, SOFTEN_HEIGHT };
-
 
73
more_less_box tbButtonOffset = { NULL, 0, 99, BUTTON_OFFSET };
-
 
74
 
-
 
75
int tbAttachment;
-
 
76
checkbox tbSoftenUp = { SOFTEN_UP };
-
 
77
checkbox tbClock = { CLOCK };
-
 
78
checkbox tbSoftenDown = { SOFTEN_DOWN };
-
 
79
checkbox tbCpuUsage = { CPU_USAGE };
-
 
80
checkbox tbMinLeftButton = { MIN_LEFT_BUTTON };
-
 
81
checkbox tbChangeLang = { CHANGE_LANG };
-
 
82
checkbox tbMinRightButton = { MIN_RIGHT_BUTTON };
-
 
83
checkbox tbMenuButton = { MENU_BUTTON };
-
 
84
checkbox dkFsize = { FSIZE };
-
 
85
checkbox dkAshow = { ASHOW };
-
 
86
 
-
 
87
int dkLocation;
80
more_less_box tbPanelHeight  = { NULL, 6, 99, PANEL_HEIGHT };
88
checkbox tbRunApplButton;
81
more_less_box tbSoftenHeight = { NULL, 0, 99, SOFTEN_HEIGHT };
89
checkbox tbClnDeskButton;
82
more_less_box tbButtonOffset = { NULL, 0, 99, BUTTON_OFFSET };
90
 
Line 83... Line 91...
83
 
91
 
Line 92... Line 100...
92
 
100
 
93
	loop() switch(WaitEvent())
101
	loop() switch(WaitEvent())
94
	{
102
	{
95
		case evButton: 
103
		case evButton: 
96
				id=GetButtonID();
104
				id=GetButtonID();
97
				if (id==1) ExitProcess();
105
				if (1==id) ExitProcess();
98
				//taskbar buttons
106
				//taskbar buttons
99
				if (id>=100) && (id<200)
-
 
100
				{
107
				if (BTN_TB_ATTACHEMENT == id) {
101
					if (id==100) tbAttachment ^= 1;
108
					tbAttachment ^= 1;
102
					if (id==105) tbSoftenUp ^= 1;
109
					DrawWindowContent(); 
-
 
110
					SaveSettingsAndRestartProcess(TASKBAR);
-
 
111
				}
103
					if (id==106) tbSoftenDown ^= 1;
112
 
104
					if (id==107) tbMinLeftButton ^= 1;
113
				if (tbSoftenUp.click(id))      || (tbSoftenDown.click(id))
105
					if (id==108) tbMinRightButton ^= 1;
114
				|| (tbMinLeftButton.click(id)) || (tbMinRightButton.click(id))
106
					if (id==109) tbRunApplButton ^= 1;
115
				|| (tbRunApplButton.click(id)) || (tbClnDeskButton.click(id)) {
107
					if (id==110) tbClnDeskButton ^= 1;
116
					SaveSettingsAndRestartProcess(TASKBAR); 
-
 
117
				}
108
					if (id==111) tbClock ^= 1;
118
 
109
					if (id==112) tbCpuUsage ^= 1;
-
 
110
					if (id==113) tbChangeLang ^= 1;
119
				if (tbClock.click(id))       || (tbCpuUsage.click(id))
111
					if (id==114) tbMenuButton ^= 1;
-
 
112
					tbPanelHeight.click(id);
120
				|| (tbChangeLang.click(id))  || (tbMenuButton.click(id))
113
					tbSoftenHeight.click(id);
121
				|| (tbPanelHeight.click(id)) || (tbSoftenHeight.click(id)) 
114
					tbButtonOffset.click(id);
-
 
115
					DrawWindowContent(TASKBAR);
-
 
116
					SaveCfg(TASKBAR);
122
				|| (tbButtonOffset.click(id)) {
117
					RestartProcess(TASKBAR);
123
					SaveSettingsAndRestartProcess(TASKBAR);
118
				}
124
				}
119
				//docky buttons			
-
 
120
				if (id>=200)
-
 
121
				{
125
				//docky buttons
122
					if (id==200)
-
 
123
					{
126
				if (id==200) {
124
						dkLocation++;
127
					dkLocation++; 
-
 
128
					if (dkLocation>3) dkLocation=1; 
-
 
129
					DrawWindowContent(); 
125
						if (dkLocation>3) dkLocation=1;
130
					SaveSettingsAndRestartProcess(DOCKY);
126
					}
-
 
127
					if (id==201) dkFsize ^= 1;
-
 
128
					if (id==202) dkAshow ^= 1;
131
				}
129
					DrawWindowContent(DOCKY);
-
 
130
					SaveCfg(DOCKY);
132
				if (dkFsize.click(id)) SaveSettingsAndRestartProcess(DOCKY);
131
					RestartProcess(DOCKY);
-
 
132
				}
133
				if (dkAshow.click(id)) SaveSettingsAndRestartProcess(DOCKY);
Line 133... Line 134...
133
				break;
134
				break;
134
				
135
				
135
		case evKey:
136
		case evKey:
Line 140... Line 141...
140
		case evReDraw:
141
		case evReDraw:
141
				system.color.get();
142
				system.color.get();
142
				DefineAndDrawWindow(130, 150, 465, 398 + skin_height, 0x34, system.color.work, WINDOW_TITLE, 0);
143
				DefineAndDrawWindow(130, 150, 465, 398 + skin_height, 0x34, system.color.work, WINDOW_TITLE, 0);
143
				GetProcessInfo(#Form, SelfInfo);
144
				GetProcessInfo(#Form, SelfInfo);
144
				if (Form.status_window>2) break;
145
				if (Form.status_window>2) break;
145
				DrawWindowContent(ALL);
146
				DrawWindowContent();
146
	}
147
	}
147
}
148
}
Line 148... Line 149...
148
 
149
 
149
void DrawWindowContent(byte panel_type)
150
void DrawWindowContent()
150
{
151
{
151
	#define PD 10
152
	#define PD 10
152
	dword frame_y;
153
	dword frame_y;
153
	word win_center_x = Form.cwidth / 2 + 20;
154
	word win_center_x = Form.cwidth / 2 + 20;
Line 154... Line -...
154
	incn y;
-
 
155
 
-
 
156
	if (panel_type==ALL) || (panel_type==TASKBAR)
155
	incn y;
157
	{
156
 
158
		frame_y = 15;
157
	frame_y = 15;
159
		y.n = frame_y;
158
	y.n = frame_y;
160
		DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 100 + BT_HIDE, 0);
159
	DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 100 + BT_HIDE, 0);
161
		_PutImage(22, y.n, 37, 27, tbAttachment * 37 * 27 * 3 + panels_img.data);
160
	_PutImage(22, y.n, 37, 27, tbAttachment * 37 * 27 * 3 + panels_img.data);
162
		WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
161
	WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
163
		CheckBox(22, y.inc(35), 105, SOFTEN_UP, tbSoftenUp);
162
	tbSoftenUp.draw(22, y.inc(35));
164
		CheckBox(win_center_x, y.n, 111, CLOCK, tbClock);
163
	tbClock.draw(win_center_x, y.n);
165
		CheckBox(22, y.inc(24), 106, SOFTEN_DOWN, tbSoftenDown);
164
	tbSoftenDown.draw(22, y.inc(24));
166
		CheckBox(win_center_x, y.n, 112, CPU_USAGE, tbCpuUsage);
165
	tbCpuUsage.draw(win_center_x, y.n);
167
		CheckBox(22, y.inc(24), 107, MIN_LEFT_BUTTON, tbMinLeftButton);
166
	tbMinLeftButton.draw(22, y.inc(24));
168
		CheckBox(win_center_x, y.n, 113, CHANGE_LANG, tbChangeLang);
167
	tbChangeLang.draw(win_center_x, y.n);
169
		CheckBox(22, y.inc(24), 108, MIN_RIGHT_BUTTON, tbMinRightButton);
168
	tbMinRightButton.draw(22, y.inc(24));
170
		CheckBox(win_center_x, y.n, 114, MENU_BUTTON, tbMenuButton);	
169
	tbMenuButton.draw(win_center_x, y.n);
171
		tbPanelHeight.draw(22, y.inc(28));
170
	tbPanelHeight.draw(22, y.inc(28));
172
		tbSoftenHeight.draw(22, y.inc(32));
171
	tbSoftenHeight.draw(22, y.inc(32));
173
		tbButtonOffset.draw(22, y.inc(32));
-
 
174
		DrawFrame(PD, frame_y, Form.cwidth-PD-PD, y.inc(32)-frame_y, TASK_FRAME_T);
-
 
175
	}
172
	tbButtonOffset.draw(22, y.inc(32));
176
	if (panel_type==ALL) || (panel_type==DOCKY)
173
	DrawFrame(PD, frame_y, Form.cwidth-PD-PD, y.inc(32)-frame_y, TASK_FRAME_T);
177
	{
174
	//DOCKY
178
		frame_y = calc(y.inc(20));
175
	frame_y = calc(y.inc(20));
179
		DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 200 + BT_HIDE, 0);
176
	DefineButton(22, y.inc(18), panels_img.w-1, 27-1, 200 + BT_HIDE, 0);
180
		_PutImage(22, y.n,  37, 27, dkLocation + 1 * 37 * 27 * 3 + panels_img.data);
177
	_PutImage(22, y.n,  37, 27, dkLocation + 1 * 37 * 27 * 3 + panels_img.data);
181
		WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
178
	WriteText(68, y.inc(7), 0x90, system.color.work_text, CHANGE_POS);
182
		CheckBox(22, y.inc(35), 201, FSIZE,  dkFsize);
179
	dkFsize.draw(22, y.inc(35)); 
183
		CheckBox(win_center_x, y.n, 202, ASHOW, dkAshow);
180
	dkAshow.draw(win_center_x, y.n);
184
		DrawFrame(PD, frame_y, Form.cwidth-PD-PD, Form.cheight-frame_y-PD, DOCK_FRAME_T);
-
 
Line 185... Line 181...
185
	}
181
	DrawFrame(PD, frame_y, Form.cwidth-PD-PD, Form.cheight-frame_y-PD, DOCK_FRAME_T);
186
}
182
}
187
 
183
 
188
void LoadCfg()
184
void LoadCfg()
189
{ 
185
{ 
190
	tbAttachment     = taskbar_flags_ini.GetInt("Attachment", 1);    
186
	tbAttachment = taskbar_flags_ini.GetInt("Attachment", 1);    
191
	tbSoftenUp       = taskbar_flags_ini.GetInt("SoftenUp", 1);      
187
	tbSoftenUp.checked       = taskbar_flags_ini.GetInt("SoftenUp", 1);      
192
	tbSoftenDown     = taskbar_flags_ini.GetInt("SoftenDown", 1);    
188
	tbSoftenDown.checked     = taskbar_flags_ini.GetInt("SoftenDown", 1);    
193
	tbMinLeftButton  = taskbar_flags_ini.GetInt("MinLeftButton", 1); 
189
	tbMinLeftButton.checked  = taskbar_flags_ini.GetInt("MinLeftButton", 1); 
194
	tbMinRightButton = taskbar_flags_ini.GetInt("MinRightButton", 1);
190
	tbMinRightButton.checked = taskbar_flags_ini.GetInt("MinRightButton", 1);
195
	tbClock          = taskbar_flags_ini.GetInt("Clock", 1);         
191
	tbClock.checked          = taskbar_flags_ini.GetInt("Clock", 1);         
196
	tbCpuUsage       = taskbar_flags_ini.GetInt("CpuUsage", 1);      
192
	tbCpuUsage.checked       = taskbar_flags_ini.GetInt("CpuUsage", 1);      
197
	tbChangeLang     = taskbar_flags_ini.GetInt("ChangeLang", 1);    
193
	tbChangeLang.checked     = taskbar_flags_ini.GetInt("ChangeLang", 1);    
198
	tbMenuButton     = taskbar_flags_ini.GetInt("MenuButton", 1);    
194
	tbMenuButton.checked     = taskbar_flags_ini.GetInt("MenuButton", 1);    
199
	tbPanelHeight.value  = taskbar_vars_ini.GetInt("PanelHeight", 28);
195
	tbPanelHeight.value  = taskbar_vars_ini.GetInt("PanelHeight", 28);
Line 200... Line 196...
200
	tbSoftenHeight.value = taskbar_vars_ini.GetInt("SoftenHeight", 4);   
196
	tbSoftenHeight.value = taskbar_vars_ini.GetInt("SoftenHeight", 4);   
201
	tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonTopOffset", 3);
197
	tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonTopOffset", 3);
202
	tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonBotOffset", 3);
198
	tbButtonOffset.value = taskbar_vars_ini.GetInt("ButtonBotOffset", 3);
203
 
199
 
Line 204... Line 200...
204
	dkLocation = docky_ini.GetInt("location", 0);
200
	dkLocation = docky_ini.GetInt("location", 0);
205
	dkFsize = docky_ini.GetInt("fsize", 0);   
201
	dkFsize.checked = docky_ini.GetInt("fsize", 0);   
206
	dkAshow = docky_ini.GetInt("ashow", 0);   
202
	dkAshow.checked = docky_ini.GetInt("ashow", 0);   
207
}
203
}
208
 
204
 
209
void SaveCfg(byte panel_type)
205
void SaveSettingsAndRestartProcess(byte panel_type)
210
{
206
{
211
	if (panel_type==TASKBAR) {
207
	if (panel_type==TASKBAR) {
212
		taskbar_flags_ini.SetInt("Attachment", tbAttachment);
208
		taskbar_flags_ini.SetInt("Attachment", tbAttachment);
213
		taskbar_flags_ini.SetInt("SoftenUp", tbSoftenUp);
209
		taskbar_flags_ini.SetInt("SoftenUp", tbSoftenUp.checked);
214
		taskbar_flags_ini.SetInt("SoftenDown", tbSoftenDown);
210
		taskbar_flags_ini.SetInt("SoftenDown", tbSoftenDown.checked);
215
		taskbar_flags_ini.SetInt("MinLeftButton", tbMinLeftButton);
211
		taskbar_flags_ini.SetInt("MinLeftButton", tbMinLeftButton.checked);
216
		taskbar_flags_ini.SetInt("MinRightButton", tbMinRightButton);
212
		taskbar_flags_ini.SetInt("MinRightButton", tbMinRightButton.checked);
217
		taskbar_flags_ini.SetInt("RunApplButton", tbRunApplButton);
213
		taskbar_flags_ini.SetInt("RunApplButton", tbRunApplButton.checked);
218
		taskbar_flags_ini.SetInt("ClnDeskButton", tbClnDeskButton);
214
		taskbar_flags_ini.SetInt("ClnDeskButton", tbClnDeskButton.checked);
219
		taskbar_flags_ini.SetInt("Clock", tbClock);
215
		taskbar_flags_ini.SetInt("Clock", tbClock.checked);
220
		taskbar_flags_ini.SetInt("CpuUsage", tbCpuUsage);
216
		taskbar_flags_ini.SetInt("CpuUsage", tbCpuUsage.checked);
221
		taskbar_flags_ini.SetInt("ChangeLang", tbChangeLang);
217
		taskbar_flags_ini.SetInt("ChangeLang", tbChangeLang.checked);
222
		taskbar_flags_ini.SetInt("MenuButton", tbMenuButton);
218
		taskbar_flags_ini.SetInt("MenuButton", tbMenuButton.checked);
223
		taskbar_vars_ini.SetInt("PanelHeight", tbPanelHeight.value);
219
		taskbar_vars_ini.SetInt("PanelHeight", tbPanelHeight.value);
224
		taskbar_vars_ini.SetInt("SoftenHeight", tbSoftenHeight.value);
220
		taskbar_vars_ini.SetInt("SoftenHeight", tbSoftenHeight.value);
225
		taskbar_vars_ini.SetInt("ButtonTopOffset", tbButtonOffset.value);
221
		taskbar_vars_ini.SetInt("ButtonTopOffset", tbButtonOffset.value);
226
		taskbar_vars_ini.SetInt("ButtonBottOffset", tbButtonOffset.value);
222
		taskbar_vars_ini.SetInt("ButtonBottOffset", tbButtonOffset.value);
227
	}
223
	}
-
 
224
	if (panel_type==DOCKY) {
228
	if (panel_type==DOCKY) {
225
		docky_ini.SetInt("location", dkLocation);
Line 229... Line 226...
229
		docky_ini.SetInt("location", dkLocation);
226
		docky_ini.SetInt("fsize", dkFsize.checked);
230
		docky_ini.SetInt("fsize", dkFsize);
227
		docky_ini.SetInt("ashow", dkAshow.checked);
231
		docky_ini.SetInt("ashow", dkAshow);
228
	}