Subversion Repositories Kolibri OS

Rev

Rev 3877 | 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
 
3848 punk_joker 3
#ifdef LANG_RUS
3434 leency 4
char *captions[] = {
3848 punk_joker 5
	"Открыть",               "Enter",
6
	"Открыть с помощью...",  "CrlEnt",
7
	"Открыть как текст",     "F3",
3877 leency 8
	"Открыть как HEX",       "F4",
3848 punk_joker 9
	//
10
	"Копировать",            "Crl+C",
11
	"Вырезать",              "Crl+X",
12
	"Вставить",              "Crl+V",
13
	"Переименовать",         "F2",
14
	"Удалить",               "Del",
15
	"Обновить",              "F5",
16
	0, 0};
3933 kaitz 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};
3848 punk_joker 31
 
32
#else
33
char *captions[] = {
3434 leency 34
	"Open",          "Enter",
3439 leency 35
	"Open with...",  "CrlEnt",
3434 leency 36
	"View as text",  "F3",
37
	"View as HEX",   "F4",
3695 leency 38
	//
39
	"Copy",          "Crl+C",
40
	"Cut",           "Crl+X",
41
	"Paste",         "Crl+V",
3434 leency 42
	"Rename",        "F2",
43
	"Delete",        "Del",
3848 punk_joker 44
	"Refresh",       "F5",
3695 leency 45
	0, 0};
3848 punk_joker 46
#endif
3434 leency 47
 
3695 leency 48
proc_info MenuForm;
49
 
3434 leency 50
void FileMenu()
51
{
3439 leency 52
	mouse mm;
3695 leency 53
	word id, key, slot, index;
3439 leency 54
	int ccount=0, cur, newi, linew=10, lineh=18, texty;
3695 leency 55
	for (index=0; captions[index]!=0; index+=2)
3434 leency 56
	{
57
		ccount++;
3695 leency 58
		if (strlen(captions[index])>linew) linew = strlen(captions[index]);
3434 leency 59
	}
3439 leency 60
	linew = linew + 3 * 6 + 50;
3434 leency 61
	texty = lineh/2-4;
62
	SetEventMask(100111b);
63
 
64
	goto _MENU_DRAW;
65
	loop() switch(WaitEvent())
66
	{
67
		case evMouse:
68
				slot = GetProcessSlot(MenuForm.ID);
69
				if (slot != GetActiveProcess()) ExitProcess();
3439 leency 70
				mm.get();
71
				newi = mm.y - 1 / lineh;
3440 leency 72
				if (mm.y<=0) || (mm.y>ccount*lineh+5) || (mm.x<0) || (mm.x>linew) newi=-1;
3439 leency 73
				if (cur<>newi)
74
				{
75
					cur=newi;
76
					goto _ITEMS_DRAW;
77
				}
3434 leency 78
				break;
79
 
80
		case evButton:
81
				id=GetButtonID();
82
				if (id==100) Open();
83
				if (id==101) notify("Not compleated yet");
3695 leency 84
				if (id==102) FnProcess(3); //F3
85
				if (id==103) FnProcess(4); //F4
86
				if (id==104) Copy(#file_path, NOCUT);
87
				if (id==105) Copy(#file_path, CUT);
88
				if (id==106) CreateThread(#Paste,#copy_stak);
89
				if (id==107) FnProcess(2);
90
				if (id==108) Del_Form();
91
				if (id==109) FnProcess(5);
3434 leency 92
				ExitProcess();
93
				break;
94
 
95
		case evKey:
96
				IF (GetKey()==27) ExitProcess();
97
				break;
98
 
99
		case evReDraw: _MENU_DRAW:
3444 leency 100
				DefineAndDrawWindow(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),linew+3,ccount*lineh+6,0x01, 0, 0, 0x01fffFFF);
3434 leency 101
				GetProcessInfo(#MenuForm, SelfInfo);
3439 leency 102
				DrawRectangle(0,0,linew+1,ccount*lineh+2,col_border);
103
				DrawBar(1,1,linew,1,0xFFFfff);
3444 leency 104
				PutShadow(linew+2,1,1,ccount*lineh+2,0,2);
105
				PutShadow(linew+3,2,1,ccount*lineh+2,0,1);
106
				PutShadow(1,ccount*lineh+3,linew+2,1,0,2);
107
				PutShadow(2,ccount*lineh+4,linew+1,1,0,1);
3434 leency 108
 
3439 leency 109
				_ITEMS_DRAW:
3695 leency 110
				for (index=0; captions[index*2]!=0; index++)
3434 leency 111
				{
3695 leency 112
					DefineButton(1,index*lineh+1,linew,lineh-1,index+100+BT_HIDE+BT_NOFRAME,0xFFFFFF);
113
					DrawBar(1,index*lineh+2,1,lineh,0xFFFfff);
114
					if (index==cur)
115
					{
116
						DrawBar(2,index*lineh+2,linew-1,lineh,0xFFFfff);
117
					}
118
					else
119
					{
120
						DrawBar(2,index*lineh+2,linew-1,lineh,col_work);
121
						WriteText(8,index*lineh+texty+3,0x80,0xf2f2f2,captions[index*2]);
122
					}
123
					WriteText(7,index*lineh+texty+2,0x80,0x000000,captions[index*2]);
124
					WriteText(-strlen(captions[index*2+1])*6-6+linew,index*lineh+texty+2,0x80,0x888888,captions[index*2+1]);
3434 leency 125
				}
126
	}
127
}