Subversion Repositories Kolibri OS

Rev

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

Rev 5997 Rev 6176
Line 8... Line 8...
8
 
8
 
9
#ifndef INCLUDE_STRING_H
9
#ifndef INCLUDE_STRING_H
10
#include "../lib/strings.h"
10
#include "../lib/strings.h"
Line -... Line 11...
-
 
11
#endif
-
 
12
 
-
 
13
#ifndef INCLUDE_RGB_H
-
 
14
#include "../lib/patterns/rgb.h"
11
#endif
15
#endif
12
 
16
 
13
:void DrawRectangle(dword x,y,w,h,color1)
17
:void DrawRectangle(dword x,y,w,h,color1)
14
{
18
{
15
	if (w<=0) || (h<=0) return;
19
	if (w<=0) || (h<=0) return;
Line 37... Line 41...
37
	DrawBar(x,y+h,w,1,color2);
41
	DrawBar(x,y+h,w,1,color2);
38
}
42
}
Line 39... Line 43...
39
 
43
 
40
:void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text)
44
:void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text)
-
 
45
{
-
 
46
	word tx = -strlen(text)*6+w/2+x+1;
41
{
47
	word ty = h/2-3+y;
-
 
48
	if (id>0) DefineButton(x,y,w,h,id,color_b);
42
	if (id>0) DefineButton(x,y,w,h,id,color_b);
49
	WriteText(tx+1,ty+1,0x80,MixColors(color_b,0,200),text);
43
	WriteText(-strlen(text)*6+w/2+x+1,h/2-3+y,0x80,color_t,text);
50
	WriteText(tx,ty,0x80,color_t,text);
Line 44... Line 51...
44
}
51
}
45
 
52
 
46
:void WriteTextCenter(dword x,y,w,color_t,text)
53
:void WriteTextCenter(dword x,y,w,color_t,text)
Line 58... Line 65...
58
        px = py / r + px;
65
        px = py / r + px;
59
        py = -px / r + py;
66
        py = -px / r + py;
60
	}
67
	}
61
}
68
}
Line 62... Line 69...
62
 
69
 
63
:void CheckBox(dword x,y,w,h, bt_id, text, graph_color, text_color, is_checked)
70
:void CheckBox(dword x,y,bt_id, text, is_checked)
-
 
71
{
64
{
72
	byte w=14, h=14;
65
	DefineButton(x-1, y-1, strlen(text)*6 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, graph_color);
73
	DefineButton(x-1, y-1, strlen(text)*6 + w + 17, h+2, bt_id+BT_HIDE+BT_NOFRAME, 0);
66
	WriteText(x+w+8, h / 2 + y -3, 0x80, text_color, text);
74
	WriteText(x+w+8, h / 2 + y -3, 0x80, system.color.work_text, text);
67
	DrawRectangle(x, y, w, h, graph_color);
75
	DrawRectangle(x, y, w, h, system.color.work_graph);
68
	if (is_checked == 0)
76
	if (is_checked == 0)
69
	{
77
	{
70
		DrawRectangle3D(x+1, y+1, w-2, h-2, 0xDDDddd, 0xffffff);
78
		DrawRectangle3D(x+1, y+1, w-2, h-2, 0xDDDddd, 0xffffff);
71
		DrawBar(x+2, y+2, w-3, h-3, 0xffffff);
79
		DrawBar(x+2, y+2, w-3, h-3, 0xffffff);
72
	} 
80
	} 
73
	else if (is_checked == 1)
81
	else if (is_checked == 1)
74
	{
82
	{
75
		DrawRectangle(x+1, y+1, w-2, h-2, 0xffffff);
-
 
76
		DrawRectangle(x+2, y+2, w-4, h-4, 0xffffff);
83
		DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff);
77
		DrawBar(x+3, y+3, w-5, h-5, graph_color);
84
		DrawBar(x+3, y+3, w-5, h-5, system.color.work_button); //0x13A113
78
	}
85
	}
79
	else if (is_checked == 2) //not active
86
	else if (is_checked == 2) //not active
80
	{
87
	{
81
		DrawRectangle(x+1, y+1, w-2, h-2, 0xffffff);
-
 
82
		DrawRectangle(x+2, y+2, w-4, h-4, 0xffffff);
88
		DrawWideRectangle(x+1, y+1, w-1, h-1, 2, 0xffffff);
83
		DrawBar(x+3, y+3, w-5, h-5, 0x888888);
89
		DrawBar(x+3, y+3, w-5, h-5, 0x888888);
84
	}
90
	}
Line 85... Line 91...
85
}
91
}
86
 
92
 
87
:void MoreLessBox(dword x,y,s, bt_id_more, bt_id_less, colors_pointer, value, text)
93
:void MoreLessBox(dword x,y, bt_id_more, bt_id_less, value, text)
88
{
94
{
89
	#define VALUE_FIELD_W 26;
-
 
90
	ESI = colors_pointer;
-
 
91
	system.color.work_graph = ESI.COLORS.work_graph;
-
 
92
	system.color.work_text = ESI.COLORS.work_text;
-
 
93
	system.color.work_button = ESI.COLORS.work_button;
95
	#define VALUE_FIELD_W 26
94
	system.color.work_button_text = ESI.COLORS.work_button_text;
96
	#define SIZE 18
95
 
97
 
96
	DrawRectangle(x, y, VALUE_FIELD_W, s, system.color.work_graph);
98
	DrawRectangle(x, y, VALUE_FIELD_W, SIZE, system.color.work_graph);
97
	DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, s-2, 0xDDDddd, 0xffffff);
99
	DrawRectangle3D(x+1, y+1, VALUE_FIELD_W-2, SIZE-2, 0xDDDddd, 0xffffff);
98
	DrawBar(x+2, y+2, VALUE_FIELD_W-3, s-3, 0xffffff);
100
	DrawBar(x+2, y+2, VALUE_FIELD_W-3, SIZE-3, 0xffffff);
99
	WriteText(x+6, s / 2 + y -3, 0x80, 0x000000, itoa(value));
101
	WriteText(x+6, SIZE / 2 + y -3, 0x80, 0x000000, itoa(value));
100
 
102
 
101
	DrawCaptButton(VALUE_FIELD_W + x + 1,     y, s, s, bt_id_more, system.color.work_button, system.color.work_button_text, "+");
103
	DrawCaptButton(VALUE_FIELD_W + x + 1,     y, SIZE, SIZE, bt_id_more, system.color.work_button, system.color.work_button_text, "+");
102
	DrawCaptButton(VALUE_FIELD_W + x + s + 2, y, s, s, bt_id_less, system.color.work_button, system.color.work_button_text, "-");
104
	DrawCaptButton(VALUE_FIELD_W + x + SIZE + 2, y, SIZE, SIZE, bt_id_less, system.color.work_button, system.color.work_button_text, "-");
Line 103... Line 105...
103
	WriteText(x+VALUE_FIELD_W+s+s+10, s / 2 + y -3, 0x80, system.color.work_text, text);
105
	WriteText(x+VALUE_FIELD_W+SIZE+SIZE+10, SIZE / 2 + y -3, 0x80, system.color.work_text, text);
104
}
106
}
105
 
107
 
Line 175... Line 177...
175
		gray = sqrt(gray) / 3;
177
		gray = sqrt(gray) / 3;
176
		DSBYTE[i] = DSBYTE[i+1] = DSBYTE[i+2] = gray;
178
		DSBYTE[i] = DSBYTE[i+1] = DSBYTE[i+2] = gray;
177
	}
179
	}
178
}
180
}
Line 179... Line -...
179
 
-
 
180
:dword ShadowPixel(dword dwColor, strength)
-
 
181
{
-
 
182
	dword iB, iG, iR;
-
 
183
	strength = 10 - strength;
-
 
184
 
-
 
185
	iB = dwColor & 0xFF; dwColor >>= 8;
-
 
186
	iG = dwColor & 0xFF; dwColor >>= 8;
-
 
187
	iR = dwColor & 0xFF; dwColor >>= 8;
-
 
188
 
-
 
189
	iB = strength * iB / 10 << 16;
-
 
190
	iG = strength * iG / 10 << 8;
-
 
191
	iR = strength * iR / 10;
-
 
192
 
-
 
193
	return iR + iG + iB;
-
 
194
}
181
 
195
:void ShadowImage(dword color_image, w, h, strength)
182
:void ShadowImage(dword color_image, w, h, strength)
196
{
183
{
197
	dword col, to;
184
	dword col, to;
198
	strength = 10 - strength;
185
	strength = 10 - strength;