Rev 6805 | Rev 7227 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6805 | Rev 6806 | ||
---|---|---|---|
Line 15... | Line 15... | ||
15 | void main() |
15 | void main() |
16 | { |
16 | { |
17 | int btn; |
17 | int btn; |
18 | char title[4196]; |
18 | char title[4196]; |
19 | if (!param) strcpy(#param, DEFAULT_FONT); |
19 | if (!param) strcpy(#param, DEFAULT_FONT); |
20 | label.init(#param); |
20 | kfont.init(#param); |
21 | tabs.active_tab=PHRASE_TAB; |
21 | tabs.active_tab=PHRASE_TAB; |
22 | strcpy(#title, "Font preview: "); |
22 | strcpy(#title, "Font preview: "); |
23 | strcat(#title, #param); |
23 | strcat(#title, #param); |
24 | loop() switch(WaitEvent()) |
24 | loop() switch(WaitEvent()) |
25 | { |
25 | { |
26 | case evButton: |
26 | case evButton: |
27 | btn = GetButtonID(); |
27 | btn = GetButtonID(); |
28 | if (btn==1) ExitProcess(); |
28 | if (btn==1) ExitProcess(); |
29 | if (btn==STRONG_BTN) label.bold ^=1; |
29 | if (btn==STRONG_BTN) kfont.bold ^=1; |
30 | if (btn==SMOOTH_BTN) label.smooth ^=1; |
30 | if (btn==SMOOTH_BTN) kfont.smooth ^=1; |
31 | if (btn==PHRASE_TAB) || (btn==CHARS_TAB) tabs.click(btn); |
31 | if (btn==PHRASE_TAB) || (btn==CHARS_TAB) tabs.click(btn); |
32 | goto _DRAW_WINDOW_CONTENT; |
32 | goto _DRAW_WINDOW_CONTENT; |
33 | case evReDraw: |
33 | case evReDraw: |
34 | system.color.get(); |
34 | system.color.get(); |
35 | DefineAndDrawWindow(215,100,500,320+skin_height,0x74,0xFFFFFF,#title,0); |
35 | DefineAndDrawWindow(215,100,500,320+skin_height,0x74,0xFFFFFF,#title,0); |
36 | GetProcessInfo(#Form, SelfInfo); |
36 | GetProcessInfo(#Form, SelfInfo); |
37 | if (Form.status_window>2) break; |
37 | if (Form.status_window>2) break; |
38 | _DRAW_WINDOW_CONTENT: |
38 | _DRAW_WINDOW_CONTENT: |
39 | DrawBar(0, 0, Form.cwidth, PANELH-1, system.color.work); |
39 | DrawBar(0, 0, Form.cwidth, PANELH-1, system.color.work); |
40 | CheckBox(10, 8, STRONG_BTN, "Bold", label.bold); |
40 | CheckBox(10, 8, STRONG_BTN, "Bold", kfont.bold); |
41 | CheckBox(83,8, SMOOTH_BTN, "Smooth", label.smooth); |
41 | CheckBox(83,8, SMOOTH_BTN, "Smooth", kfont.smooth); |
42 | tabs.draw(Form.cwidth-150, PANELH, PHRASE_TAB, "Phrase"); |
42 | tabs.draw(Form.cwidth-150, PANELH, PHRASE_TAB, "Phrase"); |
43 | tabs.draw(Form.cwidth-70, PANELH, CHARS_TAB, "Chars"); |
43 | tabs.draw(Form.cwidth-70, PANELH, CHARS_TAB, "Chars"); |
44 | DrawBar(0, PANELH-1,Form.cwidth,1,system.color.work_graph); |
44 | DrawBar(0, PANELH-1,Form.cwidth,1,system.color.work_graph); |
45 | if (!label.font) |
45 | if (!kfont.font) |
46 | { |
46 | { |
47 | DrawBar(0, PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff); |
47 | DrawBar(0, PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff); |
48 | WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded."); |
48 | WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded."); |
49 | break; |
49 | break; |
50 | } |
50 | } |
Line 55... | Line 55... | ||
55 | 55 | ||
56 | void DrawPreviewPhrase() |
56 | void DrawPreviewPhrase() |
57 | { |
57 | { |
58 | dword i, y; |
58 | dword i, y; |
59 | char line[256]; |
59 | char line[256]; |
60 | label.raw_size = free(label.raw); |
60 | kfont.raw_size = free(kfont.raw); |
61 | for (i=10, y=5; i<22; i++, y+=label.height;) //not flexible, need to calculate font count and max line length |
61 | for (i=10, y=5; i<22; i++, y+=kfont.height;) //not flexible, need to calculate font count and max line length |
62 | { |
62 | { |
63 | sprintf(#line," §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i); |
63 | sprintf(#line," §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i); |
64 | label.WriteIntoBuffer(10,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, i, #line); |
64 | kfont.WriteIntoBuffer(10,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, i, #line); |
65 | } |
65 | } |
66 | if (label.smooth) label.ApplySmooth(); |
66 | if (kfont.smooth) kfont.ApplySmooth(); |
67 | label.ShowBuffer(0, PANELH); |
67 | kfont.ShowBuffer(0, PANELH); |
Line 68... | Line 68... | ||
68 | } |
68 | } |
69 | 69 | ||
70 | void DrawPreviewChars() |
70 | void DrawPreviewChars() |
71 | { |
71 | { |
72 | dword i, x=20, y=0; |
72 | dword i, x=20, y=0; |
73 | char line[2]; |
73 | char line[2]; |
74 | line[1]=NULL; |
74 | line[1]=NULL; |
75 | label.raw_size = free(label.raw); |
75 | kfont.raw_size = free(kfont.raw); |
76 | for (i=0; i<255; i++) //not flexible, need to calculate font count and max line length |
76 | for (i=0; i<255; i++) //not flexible, need to calculate font count and max line length |
77 | { |
77 | { |
78 | line[0]=i; |
78 | line[0]=i; |
79 | label.WriteIntoBuffer(x,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, 16, #line); |
79 | kfont.WriteIntoBuffer(x,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, 16, #line); |
80 | x+= label.height+2; |
80 | x+= kfont.height+2; |
81 | if (x>=Form.cwidth-30) { |
81 | if (x>=Form.cwidth-30) { |
82 | x=20; |
82 | x=20; |
83 | y+=label.height+2; |
83 | y+=kfont.height+2; |
84 | } |
84 | } |
85 | } |
85 | } |
86 | if (label.smooth) label.ApplySmooth(); |
86 | if (kfont.smooth) kfont.ApplySmooth(); |