2015-09-02 16:15:32 +03:00
# define MEMSIZE 0x2EE80
2015-08-27 11:33:51 +03:00
# include "../lib/font.h"
# include "../lib/gui.h"
2015-09-02 16:15:32 +03:00
# define PANELH 30
2015-08-27 11:33:51 +03:00
void main ( )
{
2015-09-02 16:15:32 +03:00
proc_info Form ;
2015-12-19 00:10:45 +03:00
int i , y , btn ;
2015-08-27 11:33:51 +03:00
char line [ 256 ] , title [ 4196 ] ;
2015-12-17 22:15:49 +03:00
if ( ! param ) strcpy ( # param , DEFAULT_FONT ) ;
2015-12-19 00:10:45 +03:00
label . init ( # param ) ;
2015-11-06 17:49:37 +03:00
strcpy ( # title , " Font preview: " ) ;
2015-08-27 11:33:51 +03:00
strcat ( # title , # param ) ;
loop ( )
{
switch ( WaitEvent ( ) )
{
case evButton :
btn = GetButtonID ( ) ;
if ( btn = = 1 ) ExitProcess ( ) ;
2015-12-19 00:10:45 +03:00
if ( btn = = 2 ) label . bold ^ = 1 ;
if ( btn = = 3 ) label . italic ^ = 1 ;
if ( btn = = 4 ) label . smooth ^ = 1 ;
2015-09-02 16:15:32 +03:00
goto _DRAW_WINDOW_CONTENT ;
2015-08-27 11:33:51 +03:00
case evReDraw :
2016-02-11 16:46:53 +03:00
system . color . get ( ) ;
2015-12-17 22:15:49 +03:00
DefineAndDrawWindow ( 215 , 100 , 500 , 320 , 0x74 , 0xFFFFFF , # title ) ;
2015-09-02 16:15:32 +03:00
GetProcessInfo ( # Form , SelfInfo ) ;
2015-12-19 00:10:45 +03:00
if ( Form . status_window > 2 ) break ;
2015-09-02 16:15:32 +03:00
_DRAW_WINDOW_CONTENT :
2016-02-11 16:46:53 +03:00
DrawBar ( 0 , 0 , Form . cwidth , PANELH , system . color . work ) ;
2016-02-09 04:43:58 +03:00
CheckBox ( 10 , 8 , 2 , " Bold " , label . bold ) ;
2016-02-11 16:46:53 +03:00
CheckBox ( 83 , 8 , 3 , " Italic " , label . italic ) ;
CheckBox ( 170 , 8 , 4 , " Smooth " , label . smooth ) ;
2015-12-19 00:10:45 +03:00
label . raw_size = free ( label . raw ) ;
if ( ! label . font )
2015-08-27 11:33:51 +03:00
{
2015-12-17 22:15:49 +03:00
DrawBar ( 0 , PANELH , Form . cwidth , Form . cheight - PANELH , 0xFFFfff ) ;
WriteText ( 10 , 50 , 0x82 , 0xFF00FF , " Font is not loaded. " ) ;
2015-09-02 16:15:32 +03:00
}
2015-12-19 00:10:45 +03:00
else for ( i = 10 , y = 5 ; i < 22 ; i + + , y + = label . height ; ) //not flexible, need to calculate font count and max line length
2015-08-27 11:33:51 +03:00
{
sprintf ( # line , " <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> <20> <> <EFBFBD> <EFBFBD> <EFBFBD> <EFBFBD> /size font %d <20> <> <EFBFBD> ᥫ<EFBFBD> <E1A5AB> ." , i ) ;
2015-12-19 00:10:45 +03:00
label . write_buf ( 10 , y , Form . cwidth , Form . cheight - PANELH , 0xFFFFFF , 0 , i , # line ) ;
2015-08-27 11:33:51 +03:00
}
2015-12-19 00:10:45 +03:00
if ( label . smooth ) label . apply_smooth ( ) ;
label . show_buf ( 0 , PANELH ) ;
2015-08-27 11:33:51 +03:00
}
}
}