Subversion Repositories Kolibri OS

Rev

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

Rev 6191 Rev 6973
Line 43... Line 43...
43
	"Refresh",       "F5",109,
43
	"Refresh",       "F5",109,
44
	"Properties",       "",110,
44
	"Properties",       "",110,
45
	0, 0, 0};
45
	0, 0, 0};
46
#endif
46
#endif
Line 47... Line 47...
47
 
47
 
48
llist menu;
48
llist rbmenu;
Line 49... Line 49...
49
int cur_action_buf;
49
int cur_action_buf;
50
 
50
 
51
void FileMenu()
51
void FileMenu()
52
{
52
{
Line 53... Line 53...
53
	proc_info MenuForm;
53
	proc_info MenuForm;
54
	int index;
54
	int index;
55
 
55
 
56
	menu.ClearList();
56
	rbmenu.ClearList();
57
	menu.SetFont(6, 9, 0x80);
57
	rbmenu.SetFont(6, 9, 0x80);
58
	menu.SetSizes(0,0,10,0,18);
58
	rbmenu.SetSizes(0,0,10,0,18);
-
 
59
	for (index=0; file_captions[index]!=0; index+=3)
59
	for (index=0; file_captions[index]!=0; index+=3)
60
	{
60
	{
61
		if (itdir) && (file_captions[index+2]>=200) continue;
61
		if (itdir) && (file_captions[index+2]>=200) continue;
62
		if (selected_count > 0) && (file_captions[index+2]==100) continue; //do not show "open" for several files
62
		if (strlen(file_captions[index])>menu.w) menu.w = strlen(file_captions[index]);
63
		if (strlen(file_captions[index])>rbmenu.w) rbmenu.w = strlen(file_captions[index]);
63
		menu.count++;
64
		rbmenu.count++;
64
		menu.visible++;
65
		rbmenu.visible++;
65
	}
66
	}
66
	menu.w = menu.w + 3 * menu.font_w + 50;
67
	rbmenu.w = rbmenu.w + 3 * rbmenu.font_w + 50;
Line 67... Line 68...
67
	menu.h = menu.count * menu.item_h;
68
	rbmenu.h = rbmenu.count * rbmenu.item_h;
68
	SetEventMask(100111b);
69
	SetEventMask(100111b);
69
	goto _MENU_DRAW;
70
	goto _MENU_DRAW;
70
	
71
	
71
	loop() switch(WaitEvent())
72
	loop() switch(WaitEvent())
72
	{
73
	{
73
		case evMouse:
74
		case evMouse:
74
				mouse.get();
75
				mouse.get();
Line 75... Line 76...
75
				if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();}
76
				if (!CheckActiveProcess(MenuForm.ID)){ cmd_free=1; ExitProcess();}
76
				else if (mouse.move)&&(menu.ProcessMouse(mouse.x, mouse.y)) MenuListRedraw();
77
				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(); }
78
				else if (mouse.key&MOUSE_LEFT)&&(mouse.up) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
78
		break;
79
		break;
79
				
80
				
80
		case evKey:
81
		case evKey:
Line 81... Line 82...
81
				GetKeys();
82
				GetKeys();
82
				if (key_scancode == SCAN_CODE_ESC) {cmd_free=1;ExitProcess();}
83
				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(); }
84
				if (key_scancode == SCAN_CODE_ENTER) {action_buf = cur_action_buf; cmd_free=1; ExitProcess(); }
84
				if (menu.ProcessKey(key_scancode)) MenuListRedraw();
85
				if (rbmenu.ProcessKey(key_scancode)) MenuListRedraw();
85
				break;
86
				break;
86
				
87
				
87
		case evReDraw: _MENU_DRAW:
88
		case evReDraw: _MENU_DRAW:
88
				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);
89
				if (menu_call_mouse) DefineAndDrawWindow(mouse.x+Form.left+5, mouse.y+Form.top+GetSkinHeight(),rbmenu.w+3,rbmenu.h+6,0x01, 0, 0, 0x01fffFFF);
89
				else DefineAndDrawWindow(Form.left+files.x+15, files.item_h*files.cur_y+files.y+Form.top+30,menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
90
				else 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);
90
				GetProcessInfo(#MenuForm, SelfInfo);
91
				GetProcessInfo(#MenuForm, SelfInfo);
Line 91... Line 92...
91
				DrawRectangle(0,0,menu.w+1,menu.h+2,col_graph);
92
				DrawRectangle(0,0,rbmenu.w+1,rbmenu.h+2,col_graph);
Line 100... Line 101...
100
	int start_y=0;
101
	int start_y=0;
101
	int index;
102
	int index;
102
	for (index=0; file_captions[index*3]!=0; index++)
103
	for (index=0; file_captions[index*3]!=0; index++)
103
	{
104
	{
104
		if ((itdir) && (file_captions[index*3+2]>=200)) continue;
105
		if ((itdir) && (file_captions[index*3+2]>=200)) continue;
-
 
106
		if (selected_count > 0) && (file_captions[index+2]==100) continue;
105
		DrawBar(1,start_y+2,1,menu.item_h,0xFFFfff);
107
		DrawBar(1,start_y+2,1,rbmenu.item_h,0xFFFfff);
106
		if (start_y/menu.item_h==menu.cur_y)
108
		if (start_y/rbmenu.item_h==rbmenu.cur_y)
107
		{
109
		{
108
			cur_action_buf = file_captions[index*3+2];
110
			cur_action_buf = file_captions[index*3+2];
109
			DrawBar(2,start_y+2,menu.w-1,menu.item_h,0xFFFfff);
111
			DrawBar(2,start_y+2,rbmenu.w-1,rbmenu.item_h,0xFFFfff);
110
		}
112
		}
111
		else
113
		else
112
		{
114
		{
113
			DrawBar(2,start_y+2,menu.w-1,menu.item_h,col_work);
115
			DrawBar(2,start_y+2,rbmenu.w-1,rbmenu.item_h,col_work);
114
			WriteText(8,start_y+menu.text_y+4,menu.font_type,0xf2f2f2,file_captions[index*3]);
116
			WriteText(8,start_y+rbmenu.text_y+4,rbmenu.font_type,0xf2f2f2,file_captions[index*3]);
115
		}
117
		}
116
		WriteText(7, start_y + menu.text_y + 3, menu.font_type, 0, file_captions[index*3]);
118
		WriteText(7, start_y + rbmenu.text_y + 3, rbmenu.font_type, 0, file_captions[index*3]);
117
		WriteText(-strlen(file_captions[index*3+1])-1*menu.font_w + menu.w, start_y + menu.text_y + 3, menu.font_type, 0x888888, file_captions[index*3+1]);
119
		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]);
118
		start_y+=menu.item_h;
120
		start_y+=rbmenu.item_h;
119
	}	
121
	}	
120
}
122
}
121
123