Subversion Repositories Kolibri OS

Rev

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

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