Subversion Repositories Kolibri OS

Rev

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

Rev Author Line No. Line
4042 leency 1
//Leency 2008-2013
2
 
3
//pay attension: >200 this is only file actions, not supported by folders
4
#ifdef LANG_RUS
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,
13
	"Переименовать",         "F2",207,
14
	"Удалить",               "Del",108,
15
	"Обновить папку",        "F5",109,
5447 punk_joker 16
	"Свойства",              "",110,
4042 leency 17
	0, 0, 0};
18
#elif LANG_EST
19
char *file_captions[] = {
20
	"Ava",            "Enter",100,
21
	"Ava ...",        "CrlEnt",201,
22
	"Vaata tekstina", "F3",202,
23
	"Vaata HEX",      "F4",203,
24
	"Kopeeri",        "Crl+C",104,
25
	"Lїika",          "Crl+X",105,
26
	"Aseta",          "Crl+V",106,
27
	"Nimeta №mber",   "F2",207,
28
	"Kustuta",        "Del",108,
29
	"Vфrskenda",      "F5",109,
5447 punk_joker 30
	"Properties",       "",110,
4042 leency 31
	0, 0, 0};
32
#else
33
char *file_captions[] = {
34
	"Open",          "Enter",100,
35
	"Open with...",  "CrlEnt",201,
36
	"View as text",  "F3",202,
37
	"View as HEX",   "F4",203,
38
	"Copy",          "Crl+C",104,
39
	"Cut",           "Crl+X",105,
40
	"Paste",         "Crl+V",106,
41
	"Rename",        "F2",207,
42
	"Delete",        "Del",108,
43
	"Refresh",       "F5",109,
5447 punk_joker 44
	"Properties",       "",110,
4042 leency 45
	0, 0, 0};
46
#endif
47
 
4072 leency 48
llist menu;
49
int cur_action_buf;
4042 leency 50
 
51
void FileMenu()
52
{
5702 punk_joker 53
	word key,key2;
4042 leency 54
	proc_info MenuForm;
4072 leency 55
	int index;
4042 leency 56
 
57
	menu.ClearList();
4077 leency 58
	menu.SetSizes(0,0,10,0,0,18);
4042 leency 59
	for (index=0; file_captions[index]!=0; index+=3)
60
	{
61
		if (itdir) && (file_captions[index+2]>=200) continue;
62
		if (strlen(file_captions[index])>menu.w) menu.w = strlen(file_captions[index]);
63
		menu.count++;
4072 leency 64
		menu.visible++;
4042 leency 65
	}
66
	menu.w = menu.w + 3 * 6 + 50;
67
	menu.h = menu.count*menu.line_h;
68
	SetEventMask(100111b);
69
	goto _MENU_DRAW;
70
 
71
	loop() switch(WaitEvent())
72
	{
73
		case evMouse:
5640 pavelyakov 74
				mouse.get();
5576 pavelyakov 75
				if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();}
5640 pavelyakov 76
				else if (mouse.move)&&(menu.ProcessMouse(mouse.x, mouse.y)) MenuListRedraw();
77
				else if (mouse.key&MOUSE_LEFT)&&(mouse.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
5576 pavelyakov 78
		break;
4042 leency 79
 
80
		case evKey:
5702 punk_joker 81
				GetFullKey();
82
				key = AH;
83
				$shr  eax,16
84
				key2 = AL;
85
				if (key2==SCAN_CODE_ESC){cmd_free=1;ExitProcess();}
86
				else if (key2 == SCAN_CODE_ENTER) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
87
				if (menu.ProcessKey(key2)) MenuListRedraw();
4042 leency 88
				break;
89
 
90
		case evReDraw: _MENU_DRAW:
5640 pavelyakov 91
				if (menu_call_mouse) DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+GetSkinHeight(),menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
4136 punk_joker 92
				else DefineAndDrawWindow(Form.left+files.x+15, files.line_h*files.current+files.y+Form.top+30,menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
4042 leency 93
				GetProcessInfo(#MenuForm, SelfInfo);
5674 pavelyakov 94
				DrawRectangle(0,0,menu.w+1,menu.h+2,system.color.work_graph);
4042 leency 95
				DrawBar(1,1,menu.w,1,0xFFFfff);
96
				DrawPopupShadow(1,1,menu.w,menu.h,0);
4072 leency 97
				MenuListRedraw();
98
	}
99
}
4042 leency 100
 
4072 leency 101
void MenuListRedraw()
102
{
103
	int start_y=0;
104
	int index;
105
	for (index=0; file_captions[index*3]!=0; index++)
106
	{
107
		if ((itdir) && (file_captions[index*3+2]>=200)) continue;
108
		DrawBar(1,start_y+2,1,menu.line_h,0xFFFfff);
109
		if (start_y/menu.line_h==menu.current)
110
		{
111
			cur_action_buf = file_captions[index*3+2];
112
			DrawBar(2,start_y+2,menu.w-1,menu.line_h,0xFFFfff);
113
		}
114
		else
115
		{
5674 pavelyakov 116
			DrawBar(2,start_y+2,menu.w-1,menu.line_h,system.color.work);
4078 leency 117
			WriteText(8,start_y+menu.text_y+3,0x80,0xf2f2f2,file_captions[index*3]);
4072 leency 118
		}
5674 pavelyakov 119
		WriteText(7,start_y+menu.text_y+2,0x80,system.color.work_text,file_captions[index*3]);
4078 leency 120
		WriteText(-strlen(file_captions[index*3+1])*6-6+menu.w,start_y+menu.text_y+2,0x80,0x888888,file_captions[index*3+1]);
4072 leency 121
		start_y+=menu.line_h;
122
	}
4042 leency 123
}