Subversion Repositories Kolibri OS

Rev

Rev 3997 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3434 leency 1
//Leency 2008-2013
2
 
3997 leency 3
//pay attension: >200 this is only file actions, not supported by folders
3848 punk_joker 4
#ifdef LANG_RUS
3997 leency 5
char *file_captions[] = {
6
	"Открыть",               "Enter",100,
7
	"Открыть с помощью...",  "CrlEnt",201,
8
	"Открыть как текст",     "F3",202,
9
	"Открыть как HEX",       "F4",203,
10
	"Копировать",            "Crl+C",104,
11
	"Вырезать",              "Crl+X",105,
12
	"Вставить",              "Crl+V",106,
4028 leency 13
	"Переименовать",         "F2",207,
3997 leency 14
	"Удалить",               "Del",108,
4028 leency 15
	"Обновить папку",        "F5",109,
3997 leency 16
	0, 0, 0};
3933 kaitz 17
#elif LANG_EST
3997 leency 18
char *file_captions[] = {
19
	"Ava",            "Enter",100,
20
	"Ava ...",        "CrlEnt",201,
21
	"Vaata tekstina", "F3",202,
22
	"Vaata HEX",      "F4",203,
23
	"Kopeeri",        "Crl+C",104,
24
	"Lїika",          "Crl+X",105,
25
	"Aseta",          "Crl+V",106,
4028 leency 26
	"Nimeta №mber",   "F2",207,
3997 leency 27
	"Kustuta",        "Del",108,
28
	"Vфrskenda",      "F5",109,
29
	0, 0, 0};
3848 punk_joker 30
#else
3997 leency 31
char *file_captions[] = {
32
	"Open",          "Enter",100,
33
	"Open with...",  "CrlEnt",201,
34
	"View as text",  "F3",202,
35
	"View as HEX",   "F4",203,
36
	"Copy",          "Crl+C",104,
37
	"Cut",           "Crl+X",105,
38
	"Paste",         "Crl+V",106,
4028 leency 39
	"Rename",        "F2",207,
3997 leency 40
	"Delete",        "Del",108,
41
	"Refresh",       "F5",109,
42
	0, 0, 0};
3848 punk_joker 43
#endif
3434 leency 44
 
3695 leency 45
 
3434 leency 46
void FileMenu()
47
{
3439 leency 48
	mouse mm;
3997 leency 49
	word id, key, slot, index, start_y;
50
	proc_info MenuForm;
51
	int ccount=0, cur=0, newi, linew=10, lineh=18, texty;
52
	for (index=0; file_captions[index]!=0; index+=3)
3434 leency 53
	{
3997 leency 54
		if (itdir) && (file_captions[index+2]>=200) continue;
55
		if (strlen(file_captions[index])>linew) linew = strlen(file_captions[index]);
3434 leency 56
		ccount++;
57
	}
3439 leency 58
	linew = linew + 3 * 6 + 50;
3434 leency 59
	texty = lineh/2-4;
60
	SetEventMask(100111b);
61
 
62
	goto _MENU_DRAW;
63
	loop() switch(WaitEvent())
64
	{
65
		case evMouse:
66
				slot = GetProcessSlot(MenuForm.ID);
67
				if (slot != GetActiveProcess()) ExitProcess();
3439 leency 68
				mm.get();
69
				newi = mm.y - 1 / lineh;
3440 leency 70
				if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1;
3439 leency 71
				if (cur<>newi)
72
				{
73
					cur=newi;
74
					goto _ITEMS_DRAW;
75
				}
3434 leency 76
				break;
77
 
78
		case evButton:
4028 leency 79
				action_buf = GetButtonID();
3434 leency 80
				ExitProcess();
81
				break;
82
 
83
		case evKey:
84
				IF (GetKey()==27) ExitProcess();
85
				break;
86
 
87
		case evReDraw: _MENU_DRAW:
3444 leency 88
				DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF);
3434 leency 89
				GetProcessInfo(#MenuForm, SelfInfo);
3439 leency 90
				DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border);
91
				DrawBar(1,1,linew,1,0xFFFfff);
3991 leency 92
				DrawPopupShadow(1,1,linew,ccount*lineh,0);
3434 leency 93
 
3439 leency 94
				_ITEMS_DRAW:
3997 leency 95
				for (index=0, start_y=0; file_captions[index*3]!=0; index++)
3434 leency 96
				{
3997 leency 97
					DefineButton(1,start_y+1,linew,lineh-1,file_captions[index*3+2]+BT_HIDE+BT_NOFRAME,0xFFFFFF);
98
					if ((itdir) && (file_captions[index*3+2]>=200)) continue;
99
					DrawBar(1,start_y+2,1,lineh,0xFFFfff);
100
					if (start_y/lineh==cur)
3695 leency 101
					{
3997 leency 102
						DrawBar(2,start_y+2,linew-1,lineh,0xFFFfff);
3695 leency 103
					}
104
					else
105
					{
3997 leency 106
						DrawBar(2,start_y+2,linew-1,lineh,col_work);
107
						WriteText(8,start_y+texty+3,0x80,0xf2f2f2,file_captions[index*3]);
3695 leency 108
					}
3997 leency 109
					WriteText(7,start_y+texty+2,0x80,0x000000,file_captions[index*3]);
110
					WriteText(-strlen(file_captions[index*3+1])*6-6+linew,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]);
111
					start_y+=lineh;
3434 leency 112
				}
113
	}
114
}