Subversion Repositories Kolibri OS

Rev

Rev 4076 | 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
 
4
dword onLeft(dword right,left) {EAX=Form.width-right-left;}
5
dword onTop(dword down,up) {EAX=Form.height-GetSkinHeight()-down-up;}
6
 
7
 
8
void ShowMessage(dword message, pause_duration)
9
{
10
	int form_x=files.w-220/2+files.x;
11
	int form_y=160;
4076 leency 12
	DrawPopup(form_x,form_y,220,80,1,sc.work,sc.work_graph);
13
	WriteText(-strlen(message)*3+110+form_x,80/2-4+form_y,0x80,sc.work_text,message);
4042 leency 14
	pause(pause_duration);
15
	if (pause_duration) List_ReDraw();
16
}
17
 
18
inline fastcall signed int _strrchr( ESI,BL)
19
{
20
	int jj=0, last=strlen(ESI);
21
	do{
22
		jj++;
23
		$lodsb
24
		IF(AL==BL) last=jj;
25
	} while(AL!=0);
26
	return last;
27
}
28
 
29
 
30
dword col_palette[14] = {0xD2D3D3,0xD4D4D4,0xD6D5D6,0xD8D7D8,0xDAD8D9,0xDCDADB,
31
0xDFDCDD,0xE1DDDE,0xE2DEE0,0xE4DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1,0xE3DFE1};
32
 
33
inline fastcall void Scroll() { //Прокрутка
34
	dword on_y, i;
35
	if (files.count<=0)
36
	{
37
		on_y = 57;
38
		scroll_size = onTop(22,58);
39
	}
40
	else
41
	{
42
		on_y = files.first * onTop(22,57) / files.count +57;
43
		scroll_size=onTop(22,57) * files.visible - files.visible / files.count;
44
		if (scroll_size<20) scroll_size = 20; //устанавливаем минимальный размер скролла
45
		if (scroll_size>onTop(22,57)-on_y+56) || (files.first+files.visible>=files.count) on_y=onTop(23+scroll_size,0); //для большого списка
46
	}
47
	DrawFlatButton(onLeft(27,0),on_y,16,scroll_size,0,-1,"");//ползунок
48
	if (!scroll_used) for (i=0; i<13; i++) DrawBar(onLeft(25-i,0), on_y+2, 1, scroll_size-3, col_palette[13-i]);
49
	if (scroll_used)  for (i=0; i<13; i++) DrawBar(onLeft(25-i,0), on_y+2, 1, scroll_size-3, col_palette[i]);
50
	//поле до ползунка
51
	if (on_y>58) DrawBar(onLeft(26,0),57,15,1, 0xC7C9C9);
52
	DrawBar(onLeft(26,0),58,1, on_y-58,0xC7C9C9);
53
	DrawBar(onLeft(25,0),58,14,on_y-58,0xCED0D0);
54
	//поле после ползунка
55
	if (onTop(22,57)-scroll_size+55>on_y) DrawBar(onLeft(26,0),on_y+scroll_size+1,15,1,0xC7C9C9);
56
	DrawBar(onLeft(26,0),on_y+scroll_size+2,1,onTop(22,57)-scroll_size-on_y+55,0xC7C9C9);
57
	DrawBar(onLeft(25,0),on_y+scroll_size+2,14,onTop(22,57)-scroll_size-on_y+55,0xCED0D0);
58
}
59
 
60
void DrawFlatButton(dword x,y,width,height,id,color,text)
61
{
62
	int fill_h;
4076 leency 63
	DrawRectangle(x,y,width,height,sc.work_graph);
4042 leency 64
	DrawRectangle3D(x+1,y+1,width-2,height-2,0xFEFEFE,col_padding);
4076 leency 65
	PutPixel(x+width-1, y+1, col_padding);
4042 leency 66
	if (color!=-1) DrawFilledBar(x+2, y+2, width-3, height-3);
67
	IF (id<>0)	DefineButton(x+1,y+1,width-2,height-2,id+BT_HIDE,0xEFEBEF);
4076 leency 68
	WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,sc.work_text,text);
4042 leency 69
}
70
 
71
void DrawFilledBar(dword x, y, w, h)
72
{
73
	int i, fill_h;
74
	if (h <= 14) fill_h = h; else fill_h = 14;
75
	for (i=0; i
76
	DrawBar(x, y+i, w, h-fill_h, col_palette[14-i]);
4225 punk_joker 77
}
78
 
79
 
80
 
81
 
82
 
83
 
84
struct rd_info
85
{
86
	dword function_number, reserved[4];
87
	char path[4];
88
} rd_info;
89
 
90
#define ALL_RD_CLUSTERS 2847
91
int GetFreeRamDiskClusters()
92
{
93
	dword free_size;
94
	static dword old_free_size;
95
 
96
	rd_info.function_number = 15;
97
	strcpy(#rd_info.path, "/rd");
98
	$mov eax,58
99
	$mov ebx, #rd_info;
100
	$int 0x40
101
	if (EAX==0)
102
	{
103
		free_size=ECX;
104
		old_free_size = ECX;
105
	}
106
	else
107
	{
108
		debugi(EAX);
109
		free_size = old_free_size;
110
	}
111
	return free_size;
4042 leency 112
}