Subversion Repositories Kolibri OS

Rev

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

Rev 3992 Rev 4026
Line 1... Line 1...
1
//Leency - 2012-2013
1
//Leency - 2012-2013
Line 2... Line -...
2
 
-
 
3
#define ITEM_HEIGHT 19
-
 
4
#define ITEM_WIDTH  165
-
 
5
dword col_work    = 0xE4DFE1;
-
 
6
dword col_border  = 0x9098B0;
-
 
7
 
2
 
8
char *ITEMS_LIST[]={
3
char *ITEMS_LIST[]={
9
"WIN                  F5",54,
4
"WIN                  F5",54,
10
"DOS              Ctrl+D",04,
5
"DOS              Ctrl+D",04,
11
"KOI              Ctrl+K",11,
6
"KOI              Ctrl+K",11,
12
"UTF              Ctrl+U",21,
7
"UTF              Ctrl+U",21,
13
#ifdef LANG_RUS
8
#ifdef LANG_RUS
14
"ˆá室­¨ª áâà ­¨æë    F3",52,
9
"ˆá室­¨ª áâà ­¨æë    F3",52,
15
"Žç¨áâ¨âì ªíè ª à⨭®ª"  ,02,
-
 
16
//"TrueType fonts"       ,05,
10
"Žç¨áâ¨âì ªíè ª à⨭®ª"  ,02,
17
#else
11
#else
18
"View source          F3",52,
12
"View source          F3",52,
19
"Free image cache"       ,02,
13
"Free image cache"       ,02,
20
#endif
-
 
21
//"TrueType fonts"      ,05,
14
#endif
Line 22... Line -...
22
0}; 
-
 
23
 
-
 
24
 
-
 
25
 
15
0}; 
26
proc_info MenuForm;
16
 
27
	
17
 
28
void menu_rmb()
18
void menu_rmb()
-
 
19
{
29
{
20
	mouse mm;
-
 
21
	proc_info MenuForm;
-
 
22
	llist menu;
Line -... Line 23...
-
 
23
	int overid, key, N;
-
 
24
	dword col_work    = 0xE4DFE1;
-
 
25
	dword col_border  = 0x9098B0;
30
	mouse mm;
26
 
Line 31... Line 27...
31
	int items_num, items_cur;
27
	menu.w = 165;
32
	int id1, key, i;
28
	menu.line_h = 19;
33
	
29
	while (ITEMS_LIST[menu.count*2]) menu.count++;
34
	SetEventMask(100111b); 
-
 
35
 
-
 
36
	loop() switch(WaitEvent())
30
	SetEventMask(100111b); 
37
	{
31
 
38
	case evMouse:
32
	loop() switch(WaitEvent())
Line -... Line 33...
-
 
33
	{
39
				mm.get();
34
	case evMouse:
40
 
35
				GetProcessInfo(#MenuForm, SelfInfo);
41
				GetProcessInfo(#MenuForm, SelfInfo);
36
				N=GetProcessSlot(MenuForm.ID);
42
				id1=GetProcessSlot(MenuForm.ID);
37
				if (N<>GetActiveProcess()) ExitProcess();
43
				if (id1<>GetActiveProcess()) ExitProcess();			
-
 
44
				
38
 
45
				id1=mm.y/ITEM_HEIGHT;
-
 
46
				if (id1<0) || (id1+1>items_num) || (mm.x<0) || (mm.x>ITEM_WIDTH) break;
39
				mm.get();				
47
				if (mm.lkm) || (mm.pkm)
40
				overid=mm.y/menu.line_h;
48
				{
41
				if (overid<0) || (overid+1>menu.count) || (mm.x<0) || (mm.x>menu.w) break;
49
					ActivateWindow(GetProcessSlot(Form.ID));
42
				if (mm.lkm) || (mm.pkm)
50
					SendWindowMessage(evButton, ITEMS_LIST[items_cur*2+1]);
43
				{
51
					SwitchToAnotherThread();
44
					action_buf = ITEMS_LIST[menu.current*2+1];
52
					ExitProcess();
45
					ExitProcess();
53
				}
46
				}
Line 54... Line -...
54
				if (items_cur<>id1)
-
 
55
				{
-
 
56
					items_cur=id1;
-
 
57
					goto _ITEMS_DRAW;
47
				if (menu.current<>overid)
58
				}
48
				{
59
				break;
49
					menu.current=overid;
60
				
50
					goto _ITEMS_DRAW;
61
		case evButton: 
51
				}
62
				break;
52
				break;
63
				
53
				
64
		case evKey:
54
		case evKey:
65
				key = GetKey();
55
				key = GetKey();
66
				if (key==27) ExitProcess();
56
				if (key==27) ExitProcess();
67
				if (key==178) && (items_cur)
57
				if (key==178) && (menu.current)
68
				{
58
				{
69
					items_cur--;
59
					menu.current--;
70
					goto _ITEMS_DRAW;
60
					goto _ITEMS_DRAW;
71
				}
61
				}
72
				if (key==177) && (items_cur+1
62
				if (key==177) && (menu.current+1
73
				{
63
				{
74
					items_cur++;
64
					menu.current++;
75
					goto _ITEMS_DRAW;
65
					goto _ITEMS_DRAW;
Line 76... Line 66...
76
				}
66
				}
77
				if (key==13)
-
 
78
				{
67
				if (key==13)
79
					WB1.Scan(ITEMS_LIST[items_cur*2+1]);
68
				{
-
 
69
					action_buf = ITEMS_LIST[menu.current*2+1];
Line 80... Line 70...
80
					ExitProcess();
70
					ExitProcess();
81
				}
71
				}
82
				break;
72
				break;
-
 
73
				
83
				
74
		case evReDraw:
-
 
75
				DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,menu.w+2,menu.count*menu.line_h+4,0x01, 0, 0, 0x01fffFFF);
-
 
76
				DrawPopup(0,0,menu.w,menu.count*menu.line_h+3,0, col_work,col_border);
84
		case evReDraw:
77
				//PutPixel();
85
				while (ITEMS_LIST[items_num*2]) items_num++;
78
 
-
 
79
				_ITEMS_DRAW:
86
				DefineAndDrawWindow(Form.left+m.x,Form.top+m.y+GetSkinHeight()+3,ITEM_WIDTH+2,items_num*ITEM_HEIGHT+4,0x01, 0, 0, 0x01fffFFF);
80
				for (N=0; N
87
				DrawPopup(0,0,ITEM_WIDTH,items_num*ITEM_HEIGHT+2,0, -1,col_border);
-
 
88
 
81
				{
89
				_ITEMS_DRAW:
82
					if (N==menu.current) 
90
				for (i=0; i
83
						DrawBar(2, N*menu.line_h+2, menu.w-3, menu.line_h, 0x94AECE);
91
				{
84
					else