Subversion Repositories Kolibri OS

Rev

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

Rev 4042 Rev 4072
Line 40... Line 40...
40
	"Delete",        "Del",108,
40
	"Delete",        "Del",108,
41
	"Refresh",       "F5",109,
41
	"Refresh",       "F5",109,
42
	0, 0, 0};
42
	0, 0, 0};
43
#endif
43
#endif
Line -... Line 44...
-
 
44
 
-
 
45
llist menu;
Line 44... Line 46...
44
 
46
int cur_action_buf;
45
 
47
 
46
void FileMenu()
48
void FileMenu()
47
{
49
{
48
	mouse mm;
-
 
49
	word slot, index, start_y;
50
	mouse mm;
50
	llist menu;
51
	word slot, key;
Line 51... Line 52...
51
	proc_info MenuForm;
52
	proc_info MenuForm;
52
	int texty, newi;
53
	int index;
53
 
54
 
54
	menu.ClearList();
55
	menu.ClearList();
55
	menu.SetSizes(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),10,0,0,18);
56
	menu.SetSizes(m.x+Form.left+5,m.y+Form.top+GetSkinHeight(),10,0,0,18);
56
	for (index=0; file_captions[index]!=0; index+=3)
57
	for (index=0; file_captions[index]!=0; index+=3)
57
	{
58
	{
-
 
59
		if (itdir) && (file_captions[index+2]>=200) continue;
58
		if (itdir) && (file_captions[index+2]>=200) continue;
60
		if (strlen(file_captions[index])>menu.w) menu.w = strlen(file_captions[index]);
59
		if (strlen(file_captions[index])>menu.w) menu.w = strlen(file_captions[index]);
61
		menu.count++;
60
		menu.count++;
62
		menu.visible++;
61
	}
-
 
62
	menu.w = menu.w + 3 * 6 + 50;
63
	}
63
	menu.h = menu.count*menu.line_h;
64
	menu.w = menu.w + 3 * 6 + 50;
Line 64... Line 65...
64
	texty = menu.line_h/2-4;
65
	menu.h = menu.count*menu.line_h;
65
	SetEventMask(100111b);
66
	SetEventMask(100111b);
66
	goto _MENU_DRAW;
67
	goto _MENU_DRAW;
67
	
68
	
68
	loop() switch(WaitEvent())
69
	loop() switch(WaitEvent())
69
	{
70
	{
70
		case evMouse:
71
		case evMouse:
71
				slot = GetProcessSlot(MenuForm.ID);
72
				slot = GetProcessSlot(MenuForm.ID);
72
				if (slot != GetActiveProcess()) ExitProcess();
73
				if (slot != GetActiveProcess()) ExitProcess();
73
				mm.get();
74
				mm.get();
74
				newi = mm.y - 1 / menu.line_h;
75
				menu.current_temp = mm.y - 1 / menu.line_h;
75
				if (mm.y<=0) || (mm.y>menu.h+5) || (mm.x<0) || (mm.x>menu.w) newi=-1;
76
				if (mm.y<=0) || (mm.y>menu.h+5) || (mm.x<0) || (mm.x>menu.w) menu.current_temp = -1;
76
				if (menu.current<>newi)
77
				if (menu.current<>menu.current_temp)
77
				{
-
 
78
					menu.current=newi;
-
 
79
					goto _ITEMS_DRAW;
-
 
80
				}
78
				{
81
				break;
-
 
82
 
79
					menu.current=menu.current_temp;
Line 83... Line 80...
83
		case evButton: 
80
					MenuListRedraw();
-
 
81
				}
84
				action_buf = GetButtonID();
82
				if (mm.lkm) {action_buf = cur_action_buf; pause(5); ExitProcess(); }
-
 
83
				break;
-
 
84
				
85
				ExitProcess();
85
		case evKey:
Line 86... Line 86...
86
				break;
86
				key = GetKey();
87
				
87
				if (key==27) ExitProcess();
88
		case evKey:
88
				if (key == 13) {action_buf = cur_action_buf; ExitProcess(); }
89
				if (GetKey()==27) ExitProcess();
89
				if (menu.ProcessKey(key)) MenuListRedraw();
90
				break;
90
				break;
91
				
91
				
-
 
92
		case evReDraw: _MENU_DRAW:
-
 
93
				DefineAndDrawWindow(menu.x, menu.y,menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
-
 
94
				GetProcessInfo(#MenuForm, SelfInfo);
Line -... Line 95...
-
 
95
				DrawRectangle(0,0,menu.w+1,menu.h+2,col_border);
-
 
96
				DrawBar(1,1,menu.w,1,0xFFFfff);
92
		case evReDraw: _MENU_DRAW:
97
				DrawPopupShadow(1,1,menu.w,menu.h,0);
-
 
98
				MenuListRedraw();
-
 
99
	}
93
				DefineAndDrawWindow(menu.x, menu.y,menu.w+3,menu.h+6,0x01, 0, 0, 0x01fffFFF);
100
}
94
				GetProcessInfo(#MenuForm, SelfInfo);
101
 
95
				DrawRectangle(0,0,menu.w+1,menu.h+2,col_border);
-
 
96
				DrawBar(1,1,menu.w,1,0xFFFfff);
102
void MenuListRedraw()
97
				DrawPopupShadow(1,1,menu.w,menu.h,0);
103
{
98
 
104
	int start_y=0;
99
				_ITEMS_DRAW:
105
	int index;
-
 
106
	int texty = menu.line_h/2-4;
100
				for (index=0, start_y=0; file_captions[index*3]!=0; index++)
107
	for (index=0; file_captions[index*3]!=0; index++)
101
				{
108
	{
102
					DefineButton(1,start_y+1,menu.w,menu.line_h-1,file_captions[index*3+2]+BT_HIDE+BT_NOFRAME,0xFFFFFF);
109
		if ((itdir) && (file_captions[index*3+2]>=200)) continue;
103
					if ((itdir) && (file_captions[index*3+2]>=200)) continue;
110
		DrawBar(1,start_y+2,1,menu.line_h,0xFFFfff);
104
					DrawBar(1,start_y+2,1,menu.line_h,0xFFFfff);
111
		if (start_y/menu.line_h==menu.current)
Line 114... Line 121...
114
					WriteText(7,start_y+texty+2,0x80,0x000000,file_captions[index*3]);
121
		WriteText(7,start_y+texty+2,0x80,0x000000,file_captions[index*3]);
115
					WriteText(-strlen(file_captions[index*3+1])*6-6+menu.w,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]);
122
		WriteText(-strlen(file_captions[index*3+1])*6-6+menu.w,start_y+texty+2,0x80,0x888888,file_captions[index*3+1]);
116
					start_y+=menu.line_h;
123
		start_y+=menu.line_h;
117
				}
124
	}	
118
	}
125
}
119
}
-
 
120
126