Subversion Repositories Kolibri OS

Rev

Rev 7743 | Rev 7780 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 7743 Rev 7778
Line 1... Line -...
1
//pay attension: >200 this is only file actions, not supported by folders
-
 
2
#ifdef LANG_RUS
1
#ifdef LANG_RUS
-
 
2
 
3
char *file_captions[] = {
3
char file_actions[]= 
4
	"Žâªàëâì",               "Enter",100,
4
"Žâªàëâì           |Enter
5
	"Žâªàëâì á ¯®¬®éìî...",  "CrlEnt",201,
5
Žâªàëâì á ¯®¬®éìî  |CrlEnt
6
	"Š®¯¨à®¢ âì",            "Crl+C",104,
6
Š®¯¨à®¢ âì         |Crl+C
7
	"‚ë१ âì",              "Crl+X",105,
7
‚ë१ âì           |Crl+X
8
	"‚áâ ¢¨âì",              "Crl+V",106,
8
‚áâ ¢¨âì           |Crl+V
9
	"¥à¥¨¬¥­®¢ âì",         "F2",207,
9
¥à¥¨¬¥­®¢ âì      |F2
10
	"“¤ «¨âì",               "Del",108,
10
“¤ «¨âì            |Del
11
	"Ž¡­®¢¨âì ¯ ¯ªã",        "F5",109,
11
‘¢®©á⢠           |F8";
-
 
12
char folder_actions[]=
-
 
13
"Žâªàëâì       |Enter
-
 
14
Š®¯¨à®¢ âì     |Crl+C
-
 
15
‚ë१ âì       |Crl+X
-
 
16
‚áâ ¢¨âì       |Crl+V
-
 
17
“¤ «¨âì        |Del
12
	"‘¢®©á⢠",             "F8",110,
18
‘¢®©á⢠       |F8";
-
 
19
char empty_folder_actions[]=
13
	0, 0, 0};
20
"‚áâ ¢¨âì      |Crl+V";
-
 
21
 
14
#elif LANG_EST
22
#elif LANG_EST
15
char *file_captions[] = {
23
char file_actions[]= 
16
	"Ava",            "Enter",100,
24
"Ava           |Enter
17
	"Ava ...",        "CrlEnt",201,
25
Ava ...        |CrlEnt
18
	"Kopeeri",        "Crl+C",104,
26
Kopeeri        |Crl+C
19
	"Lõika",          "Crl+X",105,
27
Lõika          |Crl+X
20
	"Aseta",          "Crl+V",106,
28
Aseta          |Crl+V
21
	"Nimeta ümber",   "F2",207,
29
Nimeta ümber   |F2
22
	"Kustuta",        "Del",108,
30
Kustuta        |Del
-
 
31
Properties     |F8";
-
 
32
char folder_actions[]=
-
 
33
"Ava           |Enter
-
 
34
Kopeeri        |Crl+C
23
	"Värskenda",      "F5",109,
35
Lõika          |Crl+X
-
 
36
Aseta          |Crl+V
-
 
37
Kustuta        |Del
24
	"Properties",     "F8",110,
38
Properties     |F8";
-
 
39
char empty_folder_actions[]=
25
	0, 0, 0};
40
"Aseta         |Crl+V";
-
 
41
 
26
#else
42
#else
27
char *file_captions[] = {
43
char file_actions[]= 
28
	"Open",          "Enter",100,
44
"Open         |Enter 
29
	"Open with...",  "CrlEnt",201,
45
Open with...  |CrlEnt
30
	"Copy",          "Crl+C",104,
46
Copy          |Crl+C
31
	"Cut",           "Crl+X",105,
47
Cut           |Crl+X
32
	"Paste",         "Crl+V",106,
48
Paste         |Crl+V
33
	"Rename",        "F2",207,
49
Rename        |F2
34
	"Delete",        "Del",108,
50
Delete        |Del
-
 
51
Properties    |F8";
-
 
52
char folder_actions[]=
35
	"Refresh",       "F5",109,
53
"Open        |Enter 
-
 
54
Copy         |Crl+C
-
 
55
Cut          |Crl+X
-
 
56
Paste        |Crl+V
-
 
57
Delete       |Del
36
	"Properties",    "F8",110,
58
Properties   |F8";
-
 
59
char empty_folder_actions[]=
37
	0, 0, 0};
60
"Paste        |Crl+V";
-
 
61
 
38
#endif
62
#endif
Line -... Line 63...
-
 
63
 
39
 
64
//Ž¡­®¢¨âì ¯ ¯ªã      |F5
40
llist rbmenu;
65
//Värskenda      |F5
Line 41... Line -...
41
int cur_action_buf;
-
 
42
 
-
 
43
void FileMenu()
66
//Refresh      |F5
44
{
-
 
Line 45... Line -...
45
	proc_info MenuForm;
-
 
46
	int index;
-
 
47
 
-
 
48
	rbmenu.ClearList();
-
 
49
	rbmenu.SetFont(6, 9, 0x80);
-
 
50
	rbmenu.SetSizes(0,0,10,0,18);
67
 
51
	for (index=0; file_captions[index]!=0; index+=3)
-
 
52
	{
-
 
53
		if (selected_count > 0) {
-
 
54
			//if there are files selected then show only specific menu items
-
 
55
			if (file_captions[index+2]>=200) continue;
-
 
56
			if (file_captions[index+2]==100) continue;
-
 
57
		}
-
 
58
		else if (itdir) && (file_captions[index+2]>=200) continue;
-
 
59
		if (strlen(file_captions[index])>rbmenu.w) rbmenu.w = strlen(file_captions[index]);
-
 
60
		rbmenu.count++;
-
 
61
		rbmenu.visible++;
-
 
62
	}
-
 
63
	rbmenu.w = rbmenu.w + 3 * rbmenu.font_w + 50;
-
 
Line 64... Line 68...
64
	rbmenu.h = rbmenu.count * rbmenu.item_h;
68
enum { MENU_DIR=1, MENU_FILE, MENU_NO_FILE, MENU_BURGER };
65
	SetEventMask(EVM_REDRAW+EVM_KEY+EVM_BUTTON+EVM_MOUSE);
69
 
66
	goto _MENU_DRAW;
-
 
67
	
-
 
68
	loop() switch(WaitEvent())
70
bool active_menu = false;
69
	{
-
 
70
		case evMouse:
-
 
71
				mouse.get();
71
 
72
				if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();}
72
void EventMenuClick(dword _id)
73
				else if (mouse.move)&&(rbmenu.ProcessMouse(mouse.x, mouse.y)) MenuListRedraw();
73
{
74
				else if (mouse.key&MOUSE_LEFT)&&(mouse.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
74
	if (active_menu == MENU_NO_FILE) switch(_id) {
75
		break;
75
		case 1: Paste(); break;
76
				
76
	}
77
		case evKey:
77
	if (active_menu == MENU_FILE) switch(_id) {
78
				GetKeys();
78
		case 1: Open(0); break;
79
				if (key_scancode == SCAN_CODE_ESC) {cmd_free=1;ExitProcess();}
-
 
80
				if (key_scancode == SCAN_CODE_ENTER) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
79
		case 2: ShowOpenWithDialog(); break;
81
				if (rbmenu.ProcessKey(key_scancode)) MenuListRedraw();
80
		case 3: Copy(#file_path, NOCUT); break;
82
				break;
81
		case 4: Copy(#file_path, CUT); break;
83
				
82
		case 5: Paste(); break;
84
		case evReDraw: _MENU_DRAW:
83
		case 6: FnProcess(2); break;
85
				if (menu_call_mouse) 
84
		case 7: Del_Form(); break;
86
					DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+skin_height,rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF);
85
		case 8: FnProcess(8); break;
87
				else 
86
	}
88
					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);
87
	if (active_menu == MENU_DIR) switch(_id) {
89
				GetProcessInfo(#MenuForm, SelfInfo);
88
		case 1: Open(0); break;
-
 
89
		case 2: Copy(#file_path, NOCUT); break;
90
				DrawRectangle(0,0,rbmenu.w+1,rbmenu.h+2,col.graph);
90
		case 3: Copy(#file_path, CUT); break;
-
 
91
		case 4: Paste(); break;
91
				DrawBar(1,1,rbmenu.w,1,0xFFFfff);
92
		case 5: Del_Form(); break;
Line 92... Line 93...
92
				DrawPopupShadow(1,1,rbmenu.w,rbmenu.h,0);
93
		case 6: FnProcess(8); break;
93
				MenuListRedraw();
94
	}
94
	}
-
 
95
}
95
	active_menu = NULL;
Line 96... Line 96...
96
 
96
}
97
void MenuListRedraw()
-
 
98
{
-
 
Line 99... Line -...
99
	int start_y=0;
-
 
100
	int index;
-
 
101
 
97
 
102
	dword m_col_bg;
98
void EventShowListMenu()
103
	dword m_col_text;
99
{
104
	dword m_col_sh_text;
-
 
105
 
100
	dword text;
106
	for (index=0; file_captions[index*3]!=0; index++)
101
 
107
	{
102
	pause(3);
108
		if (selected_count > 0) {
103
 
109
			if (file_captions[index*3+2]==100) continue;
104
	if (!files.count) {
110
			if (file_captions[index*3+2]>=200) continue;
-
 
111
		}
105
		text = #empty_folder_actions;
112
		else if ((itdir) && (file_captions[index*3+2]>=200)) continue;
-
 
113
		DrawBar(1,start_y+2,1,rbmenu.item_h,0xFFFfff);
106
		active_menu = MENU_NO_FILE;
-
 
107
	} else if (itdir) {
114
		if (start_y/rbmenu.item_h==rbmenu.cur_y)
108
		text = #folder_actions;
-
 
109
		active_menu = MENU_DIR;
-
 
110
	} else {
115
		{
111
		text = #file_actions;
116
			cur_action_buf = file_captions[index*3+2];
112
		active_menu = MENU_FILE;
117
			m_col_bg = 0xFFFfff;
113
	}
118
			m_col_sh_text = 0xFAFAFA;
114
	open_lmenu(mouse.x+Form.left+5, mouse.y+Form.top+3+skin_height, 1, 0, text);
119
			m_col_text = 0;
-
 
120
		}
-
 
121
		else
-
 
122
		{
-
 
123
			m_col_bg = col.work;
-
 
124
			m_col_text = system.color.work_text;
115
}
125
			m_col_sh_text = system.color.work_light;
116
 
-
 
117
bool GetMenuClick()
-
 
118
{
-
 
119
	dword chick_id;
126
		}
120
	if (active_menu) && (chick_id = get_menu_click()) {
127
		DrawBar(2, start_y+2, rbmenu.w-1, rbmenu.item_h, m_col_bg);
121
		EventMenuClick(chick_id);
-
 
122
		return false;