Subversion Repositories Kolibri OS

Rev

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

Rev 7614 Rev 7647
Line 15... Line 15...
15
_tabs tabs = { PHRASE_TAB };
15
_tabs tabs = { PHRASE_TAB };
Line 16... Line 16...
16
 
16
 
17
block preview = { 0, PANELH, WIN_W, WIN_H - PANELH };
17
block preview = { 0, PANELH, WIN_W, WIN_H - PANELH };
18
checkbox bold = { "Bold", false };
18
checkbox bold = { "Bold", false };
-
 
19
checkbox smooth = { "Smooth", true };
Line 19... Line 20...
19
checkbox smooth = { "Smooth", true };
20
checkbox colored = { "Colored", true };
20
 
21
 
21
void main()
22
void main()
22
{   
23
{   
Line 29... Line 30...
29
	loop() switch(WaitEvent())
30
	loop() switch(WaitEvent())
30
	{
31
	{
31
		case evButton:
32
		case evButton:
32
			btn = GetButtonID();
33
			btn = GetButtonID();
33
			if (btn==1) ExitProcess();
34
			if (btn==1) ExitProcess();
34
			if (bold.click(btn)) kfont.bold = bold.checked;
35
			bold.click(btn); 
35
			if (smooth.click(btn)) kfont.smooth = smooth.checked;
36
			smooth.click(btn);
-
 
37
			colored.click(btn);
36
			if (btn==PHRASE_TAB) || (btn==CHARS_TAB) tabs.click(btn);
38
			if (btn==PHRASE_TAB) || (btn==CHARS_TAB) tabs.click(btn);
37
			goto _DRAW_WINDOW_CONTENT;
39
			goto _DRAW_WINDOW_CONTENT;
38
		case evReDraw:
40
		case evReDraw:
39
			system.color.get();
41
			system.color.get();
40
			DefineAndDrawWindow(215,100,WIN_W+9,WIN_H+skin_height+5,0x74,0xFFFFFF,#title,0);
42
			DefineAndDrawWindow(215,100,WIN_W+9,WIN_H+skin_height+5,0x74,0xFFFFFF,#title,0);
41
			GetProcessInfo(#Form, SelfInfo);
43
			GetProcessInfo(#Form, SelfInfo);
42
			if (Form.status_window>2) break;
44
			if (Form.status_window>2) break;
43
			_DRAW_WINDOW_CONTENT:
45
			_DRAW_WINDOW_CONTENT:
Line -... Line 46...
-
 
46
 
-
 
47
			kfont.bold = bold.checked;
-
 
48
			kfont.smooth = smooth.checked;
44
 
49
 
45
			DrawBar(0, 0, Form.cwidth, PANELH-1, system.color.work);
50
			DrawBar(0, 0, Form.cwidth, PANELH-1, system.color.work);
46
			DrawBar(0, PANELH-1,Form.cwidth,1,system.color.work_graph);
51
			DrawBar(0, PANELH-1,Form.cwidth,1,system.color.work_graph);
47
			bold.draw(10, 8);
52
			bold.draw(10, 8);
-
 
53
			smooth.draw(83,8);
Line 48... Line 54...
48
			smooth.draw(83,8);
54
			colored.draw(170,8);
49
 
55
 
Line 50... Line 56...
50
			tabs.draw_button(Form.cwidth-130, PHRASE_TAB, "Phrase");
56
			tabs.draw_button(Form.cwidth-130, PHRASE_TAB, "Phrase");
Line 59... Line 65...
59
			if (tabs.active_tab==PHRASE_TAB) DrawPreviewPhrase();
65
			if (tabs.active_tab==PHRASE_TAB) DrawPreviewPhrase();
60
			if (tabs.active_tab==CHARS_TAB) DrawPreviewChars();
66
			if (tabs.active_tab==CHARS_TAB) DrawPreviewChars();
61
	}
67
	}
62
}
68
}
Line -... Line 69...
-
 
69
 
-
 
70
dword pal[] = { 0x4E4153, 0x57417C, 0x89633B, 0x819156, 0x00CCCC, 0x2AD266, 
-
 
71
	0xE000CC, 0x0498F9, 0xC3A9F5, 0xFFC200, 0xFF5836, 0xA086BA, 
-
 
72
	0,0,0,0,0 };
63
 
73
 
64
void DrawPreviewPhrase()
74
void DrawPreviewPhrase()
65
{
75
{
-
 
76
	dword i, y;
66
	dword i, y;
77
	dword c;
67
	char line[256];
78
	char line[256];
68
	kfont.raw_size = free(kfont.raw);
79
	kfont.raw_size = free(kfont.raw);
69
	for (i=10, y=5; i<22; i++, y+=kfont.height;) //not flexible, need to calculate font count and max line length
80
	for (i=10, y=12; i<22; i++, y+=kfont.height+3;) //not flexible, need to calculate font count and max line length
-
 
81
	{
70
	{
82
		if (colored.checked) c = pal[i-10]; else c=0;
71
		sprintf(#line," §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i);
83
		sprintf(#line," §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i);
72
		kfont.WriteIntoBuffer(10,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, i, #line);
84
		kfont.WriteIntoBuffer(14,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, c, i, #line);
73
	}
85
	}
74
	if (kfont.smooth) kfont.ApplySmooth();
86
	if (kfont.smooth) kfont.ApplySmooth();
75
	kfont.ShowBuffer(preview.x, preview.y);
87
	kfont.ShowBuffer(preview.x, preview.y);