Subversion Repositories Kolibri OS

Rev

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

Rev 7481 Rev 7484
1
//pay attension: >200 this is only file actions, not supported by folders
1
//pay attension: >200 this is only file actions, not supported by folders
2
#ifdef LANG_RUS
2
#ifdef LANG_RUS
3
char *file_captions[] = {
3
char *file_captions[] = {
4
	"Žâªàëâì",               "Enter",100,
4
	"Žâªàëâì",               "Enter",100,
5
	"Žâªàëâì á ¯®¬®éìî...",  "CrlEnt",201,
5
	"Žâªàëâì á ¯®¬®éìî...",  "CrlEnt",201,
6
	"Žâªàëâì ª ª ⥪áâ",     "F3",202,
6
	"Žâªàëâì ª ª ⥪áâ",     "F3",202,
7
	"Žâªàëâì ª ª HEX",       "F4",203,
7
	"Žâªàëâì ª ª HEX",       "F4",203,
8
	"Š®¯¨à®¢ âì",            "Crl+C",104,
8
	"Š®¯¨à®¢ âì",            "Crl+C",104,
9
	"‚ë१ âì",              "Crl+X",105,
9
	"‚ë१ âì",              "Crl+X",105,
10
	"‚áâ ¢¨âì",              "Crl+V",106,
10
	"‚áâ ¢¨âì",              "Crl+V",106,
11
	"¥à¥¨¬¥­®¢ âì",         "F2",207,
11
	"¥à¥¨¬¥­®¢ âì",         "F2",207,
12
	"“¤ «¨âì",               "Del",108,
12
	"“¤ «¨âì",               "Del",108,
13
	"Ž¡­®¢¨âì ¯ ¯ªã",        "F5",109,
13
	"Ž¡­®¢¨âì ¯ ¯ªã",        "F5",109,
14
	"‘¢®©á⢠",              "",110,
14
	"‘¢®©á⢠",              "",110,
15
	0, 0, 0};
15
	0, 0, 0};
16
#elif LANG_EST
16
#elif LANG_EST
17
char *file_captions[] = {
17
char *file_captions[] = {
18
	"Ava",            "Enter",100,
18
	"Ava",            "Enter",100,
19
	"Ava ...",        "CrlEnt",201,
19
	"Ava ...",        "CrlEnt",201,
20
	"Vaata tekstina", "F3",202,
20
	"Vaata tekstina", "F3",202,
21
	"Vaata HEX",      "F4",203,
21
	"Vaata HEX",      "F4",203,
22
	"Kopeeri",        "Crl+C",104,
22
	"Kopeeri",        "Crl+C",104,
23
	"Lõika",          "Crl+X",105,
23
	"Lõika",          "Crl+X",105,
24
	"Aseta",          "Crl+V",106,
24
	"Aseta",          "Crl+V",106,
25
	"Nimeta ümber",   "F2",207,
25
	"Nimeta ümber",   "F2",207,
26
	"Kustuta",        "Del",108,
26
	"Kustuta",        "Del",108,
27
	"Värskenda",      "F5",109,
27
	"Värskenda",      "F5",109,
28
	"Properties",       "",110,
28
	"Properties",       "",110,
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",207,
39
	"Rename",        "F2",207,
40
	"Delete",        "Del",108,
40
	"Delete",        "Del",108,
41
	"Refresh",       "F5",109,
41
	"Refresh",       "F5",109,
42
	"Properties",       "",110,
42
	"Properties",       "",110,
43
	0, 0, 0};
43
	0, 0, 0};
44
#endif
44
#endif
45
 
45
 
46
llist rbmenu;
46
llist rbmenu;
47
int cur_action_buf;
47
int cur_action_buf;
48
 
48
 
49
void FileMenu()
49
void FileMenu()
50
{
50
{
51
	proc_info MenuForm;
51
	proc_info MenuForm;
52
	int index;
52
	int index;
53
 
53
 
54
	rbmenu.ClearList();
54
	rbmenu.ClearList();
55
	rbmenu.SetFont(6, 9, 0x80);
55
	rbmenu.SetFont(6, 9, 0x80);
56
	rbmenu.SetSizes(0,0,10,0,18);
56
	rbmenu.SetSizes(0,0,10,0,18);
57
	for (index=0; file_captions[index]!=0; index+=3)
57
	for (index=0; file_captions[index]!=0; index+=3)
58
	{
58
	{
-
 
59
		if (selected_count > 0) {
-
 
60
			//if there are files selected then show only specific menu items
59
		if (itdir) && (file_captions[index+2]>=200) continue;
61
			if (file_captions[index+2]>=200) continue;
60
		if (selected_count > 0) && (file_captions[index+2]>=200) continue;
62
			if (file_captions[index+2]==100) continue;
-
 
63
		}
61
		if (selected_count > 0) && (file_captions[index+2]==100) continue; //do not show "open" for several files
64
		else if (itdir) && (file_captions[index+2]>=200) continue;
62
		if (strlen(file_captions[index])>rbmenu.w) rbmenu.w = strlen(file_captions[index]);
65
		if (strlen(file_captions[index])>rbmenu.w) rbmenu.w = strlen(file_captions[index]);
63
		rbmenu.count++;
66
		rbmenu.count++;
64
		rbmenu.visible++;
67
		rbmenu.visible++;
65
	}
68
	}
66
	rbmenu.w = rbmenu.w + 3 * rbmenu.font_w + 50;
69
	rbmenu.w = rbmenu.w + 3 * rbmenu.font_w + 50;
67
	rbmenu.h = rbmenu.count * rbmenu.item_h;
70
	rbmenu.h = rbmenu.count * rbmenu.item_h;
68
	SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
71
	SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
69
	goto _MENU_DRAW;
72
	goto _MENU_DRAW;
70
	
73
	
71
	loop() switch(WaitEvent())
74
	loop() switch(WaitEvent())
72
	{
75
	{
73
		case evMouse:
76
		case evMouse:
74
				mouse.get();
77
				mouse.get();
75
				if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();}
78
				if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();}
76
				else if (mouse.move)&&(rbmenu.ProcessMouse(mouse.x, mouse.y)) MenuListRedraw();
79
				else if (mouse.move)&&(rbmenu.ProcessMouse(mouse.x, mouse.y)) MenuListRedraw();
77
				else if (mouse.key&MOUSE_LEFT)&&(mouse.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
80
				else if (mouse.key&MOUSE_LEFT)&&(mouse.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
78
		break;
81
		break;
79
				
82
				
80
		case evKey:
83
		case evKey:
81
				GetKeys();
84
				GetKeys();
82
				if (key_scancode == SCAN_CODE_ESC) {cmd_free=1;ExitProcess();}
85
				if (key_scancode == SCAN_CODE_ESC) {cmd_free=1;ExitProcess();}
83
				if (key_scancode == SCAN_CODE_ENTER) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
86
				if (key_scancode == SCAN_CODE_ENTER) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
84
				if (rbmenu.ProcessKey(key_scancode)) MenuListRedraw();
87
				if (rbmenu.ProcessKey(key_scancode)) MenuListRedraw();
85
				break;
88
				break;
86
				
89
				
87
		case evReDraw: _MENU_DRAW:
90
		case evReDraw: _MENU_DRAW:
88
				if (menu_call_mouse) 
91
				if (menu_call_mouse) 
89
					DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+skin_height,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF);
92
					DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+skin_height,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF);
90
				else 
93
				else 
91
					DefineAndDrawWindow(Form.left+files.x+15, files.item_h*files.cur_y+files.y+Form.top+30,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF);
94
					DefineAndDrawWindow(Form.left+files.x+15, files.item_h*files.cur_y+files.y+Form.top+30,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF);
92
				GetProcessInfo(#MenuForm, SelfInfo);
95
				GetProcessInfo(#MenuForm, SelfInfo);
93
				DrawRectangle(0,0,rbmenu.w+1,rbmenu.h+2,col_graph);
96
				DrawRectangle(0,0,rbmenu.w+1,rbmenu.h+2,col_graph);
94
				DrawBar(1,1,rbmenu.w,1,0xFFFfff);
97
				DrawBar(1,1,rbmenu.w,1,0xFFFfff);
95
				DrawPopupShadow(1,1,rbmenu.w,rbmenu.h,0);
98
				DrawPopupShadow(1,1,rbmenu.w,rbmenu.h,0);
96
				MenuListRedraw();
99
				MenuListRedraw();
97
	}
100
	}
98
}
101
}
99
 
102
 
100
void MenuListRedraw()
103
void MenuListRedraw()
101
{
104
{
102
	int start_y=0;
105
	int start_y=0;
103
	int index;
106
	int index;
104
 
107
 
105
	dword m_col_bg;
108
	dword m_col_bg;
106
	dword m_col_text;
109
	dword m_col_text;
107
	dword m_col_sh_text;
110
	dword m_col_sh_text;
108
 
111
 
109
	for (index=0; file_captions[index*3]!=0; index++)
112
	for (index=0; file_captions[index*3]!=0; index++)
110
	{
113
	{
-
 
114
		if (selected_count > 0) {
111
		if ((itdir) && (file_captions[index*3+2]>=200)) continue;
115
			if (file_captions[index*3+2]==100) continue;
112
		if (selected_count > 0) && (file_captions[index*3+2]==100) continue;
116
			if (file_captions[index*3+2]>=200) continue;
-
 
117
		}
113
		if (selected_count > 0) && (file_captions[index*3+2]>=200) continue;
118
		else if ((itdir) && (file_captions[index*3+2]>=200)) continue;
114
		DrawBar(1,start_y+2,1,rbmenu.item_h,0xFFFfff);
119
		DrawBar(1,start_y+2,1,rbmenu.item_h,0xFFFfff);
115
		if (start_y/rbmenu.item_h==rbmenu.cur_y)
120
		if (start_y/rbmenu.item_h==rbmenu.cur_y)
116
		{
121
		{
117
			cur_action_buf = file_captions[index*3+2];
122
			cur_action_buf = file_captions[index*3+2];
118
			m_col_bg = 0xFFFfff;
123
			m_col_bg = 0xFFFfff;
119
			m_col_sh_text = 0xFAFAFA;
124
			m_col_sh_text = 0xFAFAFA;
120
			m_col_text = 0;
125
			m_col_text = 0;
121
		}
126
		}
122
		else
127
		else
123
		{
128
		{
124
			m_col_bg = col_work;
129
			m_col_bg = col_work;
125
			m_col_text = system.color.work_text;
130
			m_col_text = system.color.work_text;
126
			m_col_sh_text = system.color.work_light;
131
			m_col_sh_text = system.color.work_light;
127
		}
132
		}
128
		DrawBar(2, start_y+2, rbmenu.w-1, rbmenu.item_h, m_col_bg);
133
		DrawBar(2, start_y+2, rbmenu.w-1, rbmenu.item_h, m_col_bg);
129
		WriteText(8, start_y + rbmenu.text_y + 4, rbmenu.font_type, m_col_sh_text, file_captions[index*3]);
134
		WriteText(8, start_y + rbmenu.text_y + 4, rbmenu.font_type, m_col_sh_text, file_captions[index*3]);
130
		WriteText(7, start_y + rbmenu.text_y + 3, rbmenu.font_type, m_col_text, file_captions[index*3]);
135
		WriteText(7, start_y + rbmenu.text_y + 3, rbmenu.font_type, m_col_text, file_captions[index*3]);
131
		WriteText(-strlen(file_captions[index*3+1])-1*rbmenu.font_w + rbmenu.w, start_y + rbmenu.text_y + 3, rbmenu.font_type, 0x888888, file_captions[index*3+1]);
136
		WriteText(-strlen(file_captions[index*3+1])-1*rbmenu.font_w + rbmenu.w, start_y + rbmenu.text_y + 3, rbmenu.font_type, 0x888888, file_captions[index*3+1]);
132
		start_y+=rbmenu.item_h;
137
		start_y+=rbmenu.item_h;
133
	}	
138
	}	
134
}
139
}