Subversion Repositories Kolibri OS

Rev

Rev 5408 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5408 Rev 5493
1
//Leency - 2012-2013
1
//Leency - 2012-2013
2
 
2
 
3
char *ITEMS_LIST[]={
3
char *ITEMS_LIST[]={
4
"WIN                Ctrl+E",05,
4
"WIN                Ctrl+E",05,
5
"DOS                Ctrl+D",04,
5
"DOS                Ctrl+D",04,
6
"KOI                Ctrl+K",11,
6
"KOI                Ctrl+K",11,
7
"UTF                Ctrl+U",21,
7
"UTF                Ctrl+U",21,
8
#ifdef LANG_RUS
8
#ifdef LANG_RUS
9
"®á¬®âà¥âì ¨á室­¨ª    F3",52,
9
"®á¬®âà¥âì ¨á室­¨ª    F3",52,
10
"¥¤ ªâ¨à®¢ âì ¨á室­¨ª F4",53,
10
"¥¤ ªâ¨à®¢ âì ¨á室­¨ª F4",53,
11
"Žç¨áâ¨âì ªíè ª à⨭®ª"    ,02,
11
"Žç¨áâ¨âì ªíè ª à⨭®ª"    ,02,
12
"ˆáâ®à¨ï"                  ,03,
12
"ˆáâ®à¨ï"                  ,03,
-
 
13
"Œ¥­¥¤¦¥à § £à㧮ª"        ,06,
13
#else
14
#else
14
"View source            F3",52,
15
"View source            F3",52,
15
"Edit source            F4",53,
16
"Edit source            F4",53,
16
"Free image cache"         ,09,
17
"Free image cache"         ,09,
17
"History"                  ,03,
18
"History"                  ,03,
-
 
19
"Download Manager"         ,06,
18
#endif
20
#endif
19
0}; 
21
0}; 
20
 
22
 
21
llist menu;
23
llist menu;
22
 
24
 
23
void menu_rmb()
25
void menu_rmb()
24
{
26
{
25
	mouse mm;
27
	mouse mm;
26
	proc_info MenuForm;
28
	proc_info MenuForm;
27
	int key;
29
	int key;
28
 
30
 
29
	menu.first = menu.current = 0;
31
	menu.first = menu.current = 0;
30
	while (ITEMS_LIST[menu.count*2]) menu.count++;
32
	while (ITEMS_LIST[menu.count*2]) menu.count++;
31
	menu.SetSizes(2,2,177,menu.count*19,0,19);
33
	menu.SetSizes(2,2,177,menu.count*19,0,19);
32
	SetEventMask(100111b); 
34
	SetEventMask(100111b); 
33
 
35
 
34
	loop() switch(WaitEvent())
36
	loop() switch(WaitEvent())
35
	{
37
	{
36
	case evMouse:
38
	case evMouse:
37
				GetProcessInfo(#MenuForm, SelfInfo);
39
				GetProcessInfo(#MenuForm, SelfInfo);
38
				if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
40
				if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
39
 
41
 
40
				mm.get();
42
				mm.get();
41
				if (menu.ProcessMouse(mm.x, mm.y)) DrawMenuList();
43
				if (menu.ProcessMouse(mm.x, mm.y)) DrawMenuList();
42
				if (mm.lkm) || (mm.pkm) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); }
44
				if (mm.lkm) || (mm.pkm) { action_buf = ITEMS_LIST[menu.current*2+1]; ExitProcess(); }
43
				break;
45
				break;
44
				
46
				
45
		case evKey:
47
		case evKey:
46
				key = GetKey();
48
				key = GetKey();
47
				if (key==27) ExitProcess();
49
				if (key==27) ExitProcess();
48
				if (menu.ProcessKey(key)) DrawMenuList();
50
				if (menu.ProcessKey(key)) DrawMenuList();
49
				if (key==13)
51
				if (key==13)
50
				{
52
				{
51
					action_buf = ITEMS_LIST[menu.current*2+1];
53
					action_buf = ITEMS_LIST[menu.current*2+1];
52
					ExitProcess();
54
					ExitProcess();
53
				}
55
				}
54
				break;
56
				break;
55
				
57
				
56
		case evReDraw:
58
		case evReDraw:
57
				DefineAndDrawWindow(Form.left+m.x-6,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
59
				DefineAndDrawWindow(Form.left+m.x-6,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
58
				DrawPopup(0,0,menu.w,menu.h+3,0, col_bg,border_color);
60
				DrawPopup(0,0,menu.w,menu.h+3,0, col_bg,border_color);
59
				DrawMenuList();				
61
				DrawMenuList();				
60
	}
62
	}
61
}
63
}
62
 
64
 
63
void DrawMenuList()
65
void DrawMenuList()
64
{
66
{
65
	int N;
67
	int N;
66
 
68
 
67
	for (N=0; N
69
	for (N=0; N
68
	{
70
	{
69
		if (N==menu.current) 
71
		if (N==menu.current) 
70
			DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, 0x94AECE);
72
			DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, 0x94AECE);
71
		else
73
		else
72
		{
74
		{
73
			DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, col_bg);
75
			DrawBar(menu.x, N*menu.line_h+menu.y, menu.w-3, menu.line_h, col_bg);
74
			WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N*2]);
76
			WriteText(19,N*menu.line_h+9,0x80,0xf2f2f2,ITEMS_LIST[N*2]);
75
		}
77
		}
76
		WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
78
		WriteText(18,N*menu.line_h+8,0x80,0x000000,ITEMS_LIST[N*2]);
77
	}
79
	}
78
	if (cur_encoding!=_DEFAULT)
80
	if (cur_encoding!=_DEFAULT)
79
	{
81
	{
80
		DrawBar(7, cur_encoding*menu.line_h+9, 4, 4, 0x444444); //show current encoding
82
		DrawBar(7, cur_encoding*menu.line_h+9, 4, 4, 0x444444); //show current encoding
81
	}
83
	}
82
	else DrawBar(7, _DOS*menu.line_h+9, 4, 4, 0x444444); //show current encoding
84
	else DrawBar(7, _DOS*menu.line_h+9, 4, 4, 0x444444); //show current encoding
83
}
85
}