Subversion Repositories Kolibri OS

Rev

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

Rev 5736 Rev 5776
Line 1... Line 1...
1
#define MEMSIZE 0x7E80
1
#define MEMSIZE 0xEE80
Line 2... Line 2...
2
 
2
 
3
#include "../lib/font.h"
-
 
4
 
3
#include "../lib/font.h"
Line 5... Line 4...
5
byte id,key;
4
#include "../lib/gui.h"
6
 
5
 
-
 
6
void main()
-
 
7
{   
-
 
8
	word i, y, btn;
7
void main()
9
	char line[256], title[4196];
8
{   
10
	font.no_bg_copy = true;
9
 
-
 
-
 
11
	font.color = 0;
10
	SetEventMask(1100111b);
12
	font.bg_color = 0xFFFFFF;
11
	
-
 
-
 
13
	if (!param) strcpy(#param, "/sys/fonts/Tahoma.kf");
-
 
14
	font.load(#param);
12
	font.load("font/Verdana.kf");
15
	strcpy(#title, "Kolibri font preview: ");
13
 
16
	strcat(#title, #param);
14
	loop()
17
	loop()
15
   {
18
	{
16
      switch(WaitEvent())
-
 
17
      {
-
 
18
		case evMouse:
-
 
19
			mouse.get();
-
 
20
		
-
 
21
			
19
	  switch(WaitEvent())
22
		break;
20
      {
23
         case evButton:
21
		case evButton:
24
            id=GetButtonID();               
-
 
25
            if (id==1) ExitProcess();
-
 
26
			break;
-
 
27
      
22
			btn = GetButtonID();
28
        case evKey:
23
			if (btn==1) ExitProcess();
29
			key = GetKey();
24
			if (btn==2) font.weight ^=1;
30
			if (key==013){ //Enter
-
 
31
				draw_window();
-
 
32
				
-
 
33
			}
-
 
34
			break;
25
			if (btn==3) font.italic ^=1;
-
 
26
			if (btn==4) font.no_bg_copy ^=1;
-
 
27
		case evReDraw:
-
 
28
			DefineAndDrawWindow(215,100,500,320,0x33,0xFFFFFF,#title);
-
 
29
			DrawBar(0, 0, 500-9, 30, 0xCCCccc);
-
 
30
			CheckBox2(10, 8, 2, "Bold",  font.weight);
35
         
31
			CheckBox2(70, 8, 3, "Italic",  font.italic);
36
         case evReDraw:
-
 
37
			draw_window();
32
			CheckBox2(140, 8, 4, "Smooth",  font.no_bg_copy);
-
 
33
			if (!font.data)
38
 
34
			{
-
 
35
				WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded.");
-
 
36
			} 
-
 
37
			else for (i=10, y=40; i<22; i++, y+=font.height;)
-
 
38
			{
-
 
39
				font.size.text = i;
-
 
40
				sprintf(#line," §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i);
39
			break;
41
				font.prepare(10,y,#line);
40
      }
42
				font.show(10, y);
41
   }
-
 
42
}
-
 
43
char buf[40];
-
 
44
void draw_window()
-
 
45
{
-
 
46
	proc_info Form;
-
 
47
	
-
 
48
	int i =8;
-
 
49
	int ii = 0;
-
 
50
	DefineAndDrawWindow(215,100,450,500,0x33,0xFFFFFF,"Window header");
-
 
51
	GetProcessInfo(#Form, SelfInfo);
-
 
52
	while(i<=45)
-
 
53
	{
-
 
54
		sprintf(#buf,"Ðàçìåð øðèôòà/size font %d ïèêñåëåé.",i);
-
 
55
		font.text(0,ii,#buf,0,i);
-
 
56
		ii+=font.height;
43
			}
57
		i++;
44
	  }
58
	}
45
	}
-
 
46
}
-
 
47
 
-
 
48
void CheckBox2(dword x, y, id, text, byte value) {
-
 
49
	CheckBox(x, y, 14, 14, id, text, system.color.work_graph, system.color.work_text, value);
59
}
50
}