Subversion Repositories Kolibri OS

Rev

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

Rev 1006 Rev 1768
Line 2... Line 2...
2
 
2
 
3
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
3
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
4
dword  os_version   = 0x00000001;
4
dword  os_version   = 0x00000001;
5
dword  start_addr   = #main;
5
dword  start_addr   = #main;
6
dword  final_addr   = #stop+32;
6
dword  final_addr   = #stop+32;
7
dword  alloc_mem    = 0x00100000;
7
dword  alloc_mem    = 0x00004096;
8
dword  x86esp_reg   = 0x0007fff0;
8
dword  x86esp_reg   = 0x00004096;
9
dword  I_Param      = 0x0;
9
dword  I_Param      = 0x0;
Line 10... Line 10...
10
dword  I_Icon       = 0x0;
10
dword  I_Icon       = 0x0;
11
 
11
 
Line 16... Line 16...
16
#define BT_DEL		0x80000000
16
#define BT_DEL		0x80000000
17
#define BT_HIDE		0x40000000
17
#define BT_HIDE	0x40000000
18
#define BT_NOFRAME	0x20000000
18
#define BT_NOFRAME	0x20000000
Line -... Line 19...
-
 
19
 
-
 
20
 
-
 
21
struct system_colors{
-
 
22
	dword frame,grab,grab_button,grab_button_text,grab_text,work,work_button,work_button_text,work_text,work_graph;
-
 
23
	void get();
-
 
24
};
-
 
25
void system_colors::get()
-
 
26
{
-
 
27
	EAX = 48;
-
 
28
	EBX = 3;
-
 
29
	ECX = #frame;
-
 
30
	EDX = 40;
Line 19... Line 31...
19
 
31
	$int	0x40
20
 
32
}
21
 
33
 
22
inline fastcall dword WaitEvent(){
34
inline fastcall dword WaitEvent(){
Line 28... Line 40...
28
inline fastcall void ExitProcess(){
40
inline fastcall void ExitProcess(){
29
 EAX = -1;              // close this program
41
 EAX = -1;              // close this program
30
 $int 0x40
42
 $int 0x40
31
}
43
}
Line 32... Line 44...
32
 
44
 
33
inline fastcall word GetKey(){
45
inline fastcall byte GetKey(){
34
 EAX = 2;              // just read it key from buffer
46
 EAX = 2;              // just read it key from buffer
35
 $int  0x40
47
 $int  0x40
36
 EAX = EAX >> 8;
48
 EAX = EAX >> 8;
Line 37... Line 49...
37
}
49
}
38
 
50
 
39
inline fastcall word GetButtonID(){
51
inline fastcall byte GetButtonID(){
40
 EAX = 17;            // Get ID
52
 EAX = 17;            // Get ID
41
 $int  0x40
53
 $int  0x40
Line 54... Line 66...
54
	EAX = 8;
66
	EAX = 8;
55
	EDX += BT_DEL;
67
	EDX += BT_DEL;
56
	$int 0x40;
68
	$int 0x40;
57
}
69
}
Line 58... Line -...
58
 
-
 
59
inline fastcall dword strlen(dword EDI){
-
 
60
	ECX=EAX=0;
-
 
61
	ECX--;
-
 
62
	$REPNE $SCASB
-
 
63
	EAX-=2+ECX;
-
 
64
}
-
 
Line 65... Line 70...
65
 
70
 
66
 
71
 
67
inline fastcall void WindowRedrawStatus(dword EBX){
72
inline fastcall void WindowRedrawStatus(dword EBX){
68
	EAX = 12;
73
	EAX = 12;
Line 69... Line 74...
69
	$int 0x40
74
	$int 0x40
70
}
75
}
-
 
76
 
71
 
77
 
72
 
78
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
73
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
79
{
74
{
80
 	EAX = 0;
75
	EBX = x << 16 + sizeX;
-
 
76
	ECX = y << 16 + sizeY;
81
	EBX = x << 16 + sizeX;
77
	EDX = mainAreaType << 24 | mainAreaColour;
82
	ECX = y << 16 + sizeY;
Line 78... Line 83...
78
	ESI = headerType << 24 | headerColour;
83
	EDX = mainAreaType << 24 | mainAreaColour;
79
	$xor eax,eax
84
	ESI = headerType << 24 | headerColour;
Line 104... Line 109...
104
	ECX = y<<16+h;
109
	ECX = y<<16+h;
105
 	$int 0x40
110
 	$int 0x40
106
}
111
}
Line 107... Line -...
107
 
-
 
108
 
-
 
109
void DrawRegion(dword x,y,width,height,color1)
-
 
110
{
-
 
111
	DrawBar(x,y,width,1,color1); //ïîëîñà ãîð ñâåðõó
-
 
112
	DrawBar(x,y+height,width,1,color1); //ïîëîñà ãîð ñíèçó
-
 
113
	DrawBar(x,y,1,height,color1); //ïîëîñà âåðò ñëåâà
-
 
114
	DrawBar(x+width,y,1,height+1,color1); //ïîëîñà âåðò ñïðàâà
-
 
115
}
-
 
116
 
-
 
117
void DrawFlatButton(dword x,y,width,height,id,color,text)
-
 
118
{
-
 
119
	DrawRegion(x,y,width,height,0x94AECE);
-
 
120
	DrawBar(x+1,y+1,width-1,1,0xFFFFFF); //ïîëîñà ãîð áåëàÿ
-
 
121
	DrawBar(x+1,y+height-1,width-2,1,0xC7C7C7); //òåíü âåðò
-
 
122
	DrawBar(x+1,y+1,1,height-1,0xFFFFFF); //ïîëîñà âåðò áåëàÿ
-
 
123
	DrawBar(x+width-1,y+2,1,height-2,0xC7C7C7); //òåíü âåðò
-
 
124
	DrawBar(x+2,y+2,width-3,height-3,color); //çàëèâêà
-
 
125
	IF (id<>0) DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF); //îïðåäåëÿåì êíîïêó
-
 
126
	WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0);
-
 
127
}
-
 
128
 
112
 
129
 
113
 
130
void PutImage(dword EBX,w,h,x,y)
114
void PutImage(dword EBX,w,h,x,y)
131
{
115
{
132
	EAX = 7;
116
	EAX = 7;
Line 150... Line 134...
150
 
134
 
151
void WriteNumber(dword x,y,byte fontType, ESI, ECX)
135
void WriteNumber(dword x,y,byte fontType, ESI, ECX)
152
{
136
{
153
	EAX = 47;
137
	EAX = 47;
154
	EBX = 2<<16;
-
 
155
	/*ecx = 0
-
 
156
	while(eax>10)
-
 
157
	{
-
 
158
		ecx ++;
-
 
159
		eax /= 10;
-
 
160
	}*/
138
	EBX = 2<<16;
161
	EDX = x<<16+y;
139
	EDX = x<<16+y;
162
	ESI = fontType<<24+ESI;
140
	ESI = fontType<<24+ESI;
163
	$int 0x40;
141
	$int 0x40;