Subversion Repositories Kolibri OS

Rev

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

Rev 3877 Rev 3933
1
//Leency 2008-2013
1
//Leency 2008-2013
2
 
2
 
3
#ifdef LANG_RUS
3
#ifdef LANG_RUS
4
char *captions[] = {
4
char *captions[] = {
5
	"Žâªàëâì",               "Enter",
5
	"Žâªàëâì",               "Enter",
6
	"Žâªàëâì á ¯®¬®éìî...",  "CrlEnt",
6
	"Žâªàëâì á ¯®¬®éìî...",  "CrlEnt",
7
	"Žâªàëâì ª ª ⥪áâ",     "F3",
7
	"Žâªàëâì ª ª ⥪áâ",     "F3",
8
	"Žâªàëâì ª ª HEX",       "F4",
8
	"Žâªàëâì ª ª HEX",       "F4",
9
	//
9
	//
10
	"Š®¯¨à®¢ âì",            "Crl+C",
10
	"Š®¯¨à®¢ âì",            "Crl+C",
11
	"‚ë१ âì",              "Crl+X",
11
	"‚ë१ âì",              "Crl+X",
12
	"‚áâ ¢¨âì",              "Crl+V",
12
	"‚áâ ¢¨âì",              "Crl+V",
13
	"¥à¥¨¬¥­®¢ âì",         "F2",
13
	"¥à¥¨¬¥­®¢ âì",         "F2",
14
	"“¤ «¨âì",               "Del",
14
	"“¤ «¨âì",               "Del",
15
	"Ž¡­®¢¨âì",              "F5",
15
	"Ž¡­®¢¨âì",              "F5",
16
	0, 0};
16
	0, 0};
-
 
17
#elif LANG_EST
-
 
18
char *captions[] = {
-
 
19
	"Ava",            "Enter",
-
 
20
	"Ava ...",        "CrlEnt",
-
 
21
	"Vaata tekstina", "F3",
-
 
22
	"Vaata HEX",      "F4",
-
 
23
	//
-
 
24
	"Kopeeri",        "Crl+C",
-
 
25
	"Lõika",          "Crl+X",
-
 
26
	"Aseta",          "Crl+V",
-
 
27
	"Nimeta ümber",   "F2",
-
 
28
	"Kustuta",        "Del",
-
 
29
	"Värskenda",      "F5",
-
 
30
	0, 0};
17
 
31
 
18
#else
32
#else
19
char *captions[] = {
33
char *captions[] = {
20
	"Open",          "Enter",
34
	"Open",          "Enter",
21
	"Open with...",  "CrlEnt",
35
	"Open with...",  "CrlEnt",
22
	"View as text",  "F3",
36
	"View as text",  "F3",
23
	"View as HEX",   "F4",
37
	"View as HEX",   "F4",
24
	//
38
	//
25
	"Copy",          "Crl+C",
39
	"Copy",          "Crl+C",
26
	"Cut",           "Crl+X",
40
	"Cut",           "Crl+X",
27
	"Paste",         "Crl+V",
41
	"Paste",         "Crl+V",
28
	"Rename",        "F2",
42
	"Rename",        "F2",
29
	"Delete",        "Del",
43
	"Delete",        "Del",
30
	"Refresh",       "F5",
44
	"Refresh",       "F5",
31
	0, 0};
45
	0, 0};
32
#endif
46
#endif
33
 
47
 
34
proc_info MenuForm;
48
proc_info MenuForm;
35
 
49
 
36
void FileMenu()
50
void FileMenu()
37
{
51
{
38
	mouse mm;
52
	mouse mm;
39
	word id, key, slot, index;
53
	word id, key, slot, index;
40
	int ccount=0, cur, newi, linew=10, lineh=18, texty;
54
	int ccount=0, cur, newi, linew=10, lineh=18, texty;
41
	for (index=0; captions[index]!=0; index+=2)
55
	for (index=0; captions[index]!=0; index+=2)
42
	{
56
	{
43
		ccount++;
57
		ccount++;
44
		if (strlen(captions[index])>linew) linew = strlen(captions[index]);
58
		if (strlen(captions[index])>linew) linew = strlen(captions[index]);
45
	}
59
	}
46
	linew = linew + 3 * 6 + 50;
60
	linew = linew + 3 * 6 + 50;
47
	texty = lineh/2-4;
61
	texty = lineh/2-4;
48
	SetEventMask(100111b);
62
	SetEventMask(100111b);
49
 
63
 
50
	goto _MENU_DRAW;
64
	goto _MENU_DRAW;
51
	loop() switch(WaitEvent())
65
	loop() switch(WaitEvent())
52
	{
66
	{
53
		case evMouse:
67
		case evMouse:
54
				slot = GetProcessSlot(MenuForm.ID);
68
				slot = GetProcessSlot(MenuForm.ID);
55
				if (slot != GetActiveProcess()) ExitProcess();
69
				if (slot != GetActiveProcess()) ExitProcess();
56
				mm.get();
70
				mm.get();
57
				newi = mm.y - 1 / lineh;
71
				newi = mm.y - 1 / lineh;
58
				if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1;
72
				if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1;
59
				if (cur<>newi)
73
				if (cur<>newi)
60
				{
74
				{
61
					cur=newi;
75
					cur=newi;
62
					goto _ITEMS_DRAW;
76
					goto _ITEMS_DRAW;
63
				}
77
				}
64
				break;
78
				break;
65
 
79
 
66
		case evButton: 
80
		case evButton: 
67
				id=GetButtonID();
81
				id=GetButtonID();
68
				if (id==100) Open();
82
				if (id==100) Open();
69
				if (id==101) notify("Not compleated yet");
83
				if (id==101) notify("Not compleated yet");
70
				if (id==102) FnProcess(3); //F3
84
				if (id==102) FnProcess(3); //F3
71
				if (id==103) FnProcess(4); //F4
85
				if (id==103) FnProcess(4); //F4
72
				if (id==104) Copy(#file_path, NOCUT);
86
				if (id==104) Copy(#file_path, NOCUT);
73
				if (id==105) Copy(#file_path, CUT);
87
				if (id==105) Copy(#file_path, CUT);
74
				if (id==106) CreateThread(#Paste,#copy_stak);
88
				if (id==106) CreateThread(#Paste,#copy_stak);
75
				if (id==107) FnProcess(2);
89
				if (id==107) FnProcess(2);
76
				if (id==108) Del_Form();
90
				if (id==108) Del_Form();
77
				if (id==109) FnProcess(5);
91
				if (id==109) FnProcess(5);
78
				ExitProcess();
92
				ExitProcess();
79
				break;
93
				break;
80
				
94
				
81
		case evKey:
95
		case evKey:
82
				IF (GetKey()==27) ExitProcess();
96
				IF (GetKey()==27) ExitProcess();
83
				break;
97
				break;
84
				
98
				
85
		case evReDraw: _MENU_DRAW:
99
		case evReDraw: _MENU_DRAW:
86
				DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF);
100
				DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF);
87
				GetProcessInfo(#MenuForm, SelfInfo);
101
				GetProcessInfo(#MenuForm, SelfInfo);
88
				DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border);
102
				DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border);
89
				DrawBar(1,1,linew,1,0xFFFfff);
103
				DrawBar(1,1,linew,1,0xFFFfff);
90
				PutShadow(linew+2,1,1,ccount*lineh+2,0,2);
104
				PutShadow(linew+2,1,1,ccount*lineh+2,0,2);
91
				PutShadow(linew+3,2,1,ccount*lineh+2,0,1);
105
				PutShadow(linew+3,2,1,ccount*lineh+2,0,1);
92
				PutShadow(1,ccount*lineh+3,linew+2,1,0,2);
106
				PutShadow(1,ccount*lineh+3,linew+2,1,0,2);
93
				PutShadow(2,ccount*lineh+4,linew+1,1,0,1);
107
				PutShadow(2,ccount*lineh+4,linew+1,1,0,1);
94
 
108
 
95
				_ITEMS_DRAW:
109
				_ITEMS_DRAW:
96
				for (index=0; captions[index*2]!=0; index++)
110
				for (index=0; captions[index*2]!=0; index++)
97
				{
111
				{
98
					DefineButton(1,index*lineh+1,linew,lineh-1,index+100+BT_HIDE+BT_NOFRAME,0xFFFFFF);
112
					DefineButton(1,index*lineh+1,linew,lineh-1,index+100+BT_HIDE+BT_NOFRAME,0xFFFFFF);
99
					DrawBar(1,index*lineh+2,1,lineh,0xFFFfff);
113
					DrawBar(1,index*lineh+2,1,lineh,0xFFFfff);
100
					if (index==cur)
114
					if (index==cur)
101
					{
115
					{
102
						DrawBar(2,index*lineh+2,linew-1,lineh,0xFFFfff);
116
						DrawBar(2,index*lineh+2,linew-1,lineh,0xFFFfff);
103
					}
117
					}
104
					else
118
					else
105
					{
119
					{
106
						DrawBar(2,index*lineh+2,linew-1,lineh,col_work);
120
						DrawBar(2,index*lineh+2,linew-1,lineh,col_work);
107
						WriteText(8,index*lineh+texty+3,0x80,0xf2f2f2,captions[index*2]);
121
						WriteText(8,index*lineh+texty+3,0x80,0xf2f2f2,captions[index*2]);
108
					}
122
					}
109
					WriteText(7,index*lineh+texty+2,0x80,0x000000,captions[index*2]);
123
					WriteText(7,index*lineh+texty+2,0x80,0x000000,captions[index*2]);
110
					WriteText(-strlen(captions[index*2+1])*6-6+linew,index*lineh+texty+2,0x80,0x888888,captions[index*2+1]);
124
					WriteText(-strlen(captions[index*2+1])*6-6+linew,index*lineh+texty+2,0x80,0x888888,captions[index*2+1]);
111
				}
125
				}
112
	}
126
	}
113
}
127
}