Subversion Repositories Kolibri OS

Rev

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

Rev 7779 Rev 7780
Line 10... Line 10...
10
 
10
 
11
llist menu1;
11
llist menu1;
12
collection names;
12
collection names;
Line 13... Line 13...
13
collection hotkeys;
13
collection hotkeys;
Line 14... Line 14...
14
 
14
 
15
int win_x, win_y;
15
int selected, win_x, win_y;
Line 16... Line -...
16
 
-
 
17
int max_name_len;
-
 
18
int max_hotkey_len;
-
 
19
 
-
 
20
int selected = 0;
-
 
21
 
-
 
22
/*
-
 
23
dword cur_param = #param;
-
 
24
int GetNextParam()
-
 
25
{
-
 
26
	int result;
-
 
27
	dword next_param = strchr(cur_param, ' ');
-
 
28
	ESBYTE[next_param] = '\0';
-
 
29
	result = atoi(cur_param);
-
 
30
	cur_param = next_param+1;
-
 
31
	return result;	
16
 
32
}
17
int max_name_len;
33
*/
18
int max_hotkey_len;
34
 
19
 
-
 
20
void GetWindowPosition()
35
void GetWindowPosition()
21
{
36
{
22
	int position;
37
	int position, rez;
23
	shared_mem = memopen(#shared_name, 16, SHM_OPEN + SHM_WRITE);
38
	shared_mem = memopen(#shared_name, 20, SHM_READ);
24
	selected = ESDWORD[shared_mem     ];
39
	win_x    = ESDWORD[shared_mem +  4];
25
	win_x    = ESDWORD[shared_mem +  4];
40
	win_y    = ESDWORD[shared_mem +  8];
26
	win_y    = ESDWORD[shared_mem +  8];
41
	position = ESDWORD[shared_mem + 12];
27
	position = ESDWORD[shared_mem + 12];
42
	selected = ESDWORD[shared_mem + 16];
28
	if (position == MENU_ALIGN_TOP_RIGHT) win_x -= menu1.w;
43
	if (position==2) win_x -= menu1.w;
29
	if (position == MENU_ALIGN_BOT_LEFT) win_y -= menu1.h;
-
 
30
	if (position == MENU_ALIGN_BOT_RIGHT) {
-
 
31
		win_x -= menu1.w;
-
 
32
		win_y -= menu1.h;
-
 
33
	}
-
 
34
}
-
 
35
 
-
 
36
void GetMenuWidths()
-
 
37
{
-
 
38
	int i;
-
 
39
	for (i=0; i
-
 
40
		max_name_len = math.max(max_name_len, strlen(names.get(i)));
-
 
41
	}
-
 
42
	for (i=0; i
44
	if (position==3) {
43
		max_hotkey_len = math.max(max_hotkey_len, strlen(hotkeys.get(i)));
45
		win_x -= menu1.w;
44
	}
Line 46... Line 45...
46
		win_y -= menu1.h;
45
	max_name_len = max_name_len * 6;
47
	}
46
	max_hotkey_len *= 6;
48
	if (position==4) win_y -= menu1.h;
47
	if (max_hotkey_len) max_name_len += 12;
Line 76... Line 75...
76
	proc_info Form;
75
	proc_info Form;
Line 77... Line 76...
77
 
76
 
Line 78... Line 77...
78
	if (!param) die("'Menu component is for developers only' -I");
77
	if (!param) die("'Menu component is for developers only' -I");
79
 
78
 
80
	GetMenuItems(#param);
-
 
Line 81... Line 79...
81
	max_name_len = strlen(names.get(0)) * 6;
79
	GetMenuItems(#param);
82
	max_hotkey_len = strlen(hotkeys.get(0)) * 6;
80
	GetMenuWidths();
83
 
81
 
84
	menu1.count = names.count;
82
	menu1.count = names.count;
Line 143... Line 141...
143
 
141
 
144
	dword active_background_color = MixColors(system.color.work_button, system.color.work,230);
142
	dword active_background_color = MixColors(system.color.work_button, system.color.work,230);
145
	dword active_top_border_color = MixColors(system.color.work_graph, system.color.work_button,240);
143
	dword active_top_border_color = MixColors(system.color.work_graph, system.color.work_button,240);
146
	dword inactive_text_shadow_color = MixColors(system.color.work,0xFFFfff,150);
144
	dword inactive_text_shadow_color = MixColors(system.color.work,0xFFFfff,150);
147
	dword text_color;
145
	dword text_color;
Line 148... Line 146...
148
	bool skin_dark = is_the_skin_dark();
146
	bool skin_dark = skin_is_dark();
149
 
147
 
150
	for (i=0; i
148
	for (i=0; i
151
	{
149
	{
Line 162... Line 160...
162
			if (!skin_dark) WriteText(13+1, item_y + menu1.text_y +1, 0x80, inactive_text_shadow_color, names.get(i));
160
			if (!skin_dark) WriteText(13+1, item_y + menu1.text_y +1, 0x80, inactive_text_shadow_color, names.get(i));
163
			WriteText(13 + max_name_len, item_y + menu1.text_y, 0x80, system.color.work_graph, hotkeys.get(i));
161
			WriteText(13 + max_name_len, item_y + menu1.text_y, 0x80, system.color.work_graph, hotkeys.get(i));
164
		}
162
		}
165
		WriteText(13, item_y + menu1.text_y, 0x80, text_color, names.get(i));
163
		WriteText(13, item_y + menu1.text_y, 0x80, text_color, names.get(i));
166
	}
164
	}
167
	if (selected) WriteText(5, selected*ITEM_H + menu1.y + menu1.text_y, 0x80, 0xEE0000, "\x10");
165
	if (selected) WriteText(5, selected-1*ITEM_H + menu1.y + menu1.text_y, 0x80, 0xEE0000, "\x10");
168
}
166
}
Line 169... Line 167...
169
 
167
 
170
void click()
168
void click()
171
{
-
 
172
	char res[2];
-
 
173
	res[0] = menu1.cur_y + 1;
-
 
174
	res[1] = '\0';
169
{
175
	//ESDWORD[shared_mem] = menu1.cur_y + 1;
-
 
176
	CreateFile(2, #res, "/tmp0/1/menu.tmp");
170
	ESDWORD[shared_mem] = menu1.cur_y + 1;
177
	ExitProcess();
171
	ExitProcess();
Line 178... Line 172...
178
}
172
}
179
 
173
 
180
void exit()
174
void exit()
181
{
-
 
182
	//ESDWORD[shared_mem] = 0;
175
{
183
	CreateFile(2, 0, "/tmp0/1/menu.tmp");
176
	ESDWORD[shared_mem] = 0;