Add application kf viewer
git-svn-id: svn://kolibrios.org@5884 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
cd41c5ddfc
commit
ab10597e23
@ -70,6 +70,7 @@ img_files = {
|
|||||||
{"SETTINGS/NETWORK.INI", build_type .. "/settings/network.ini"},
|
{"SETTINGS/NETWORK.INI", build_type .. "/settings/network.ini"},
|
||||||
{"NETWORK/FTPD.INI", "common/network/ftpd.ini"},
|
{"NETWORK/FTPD.INI", "common/network/ftpd.ini"},
|
||||||
{"NETWORK/USERS.INI", "common/network/users.ini"},
|
{"NETWORK/USERS.INI", "common/network/users.ini"},
|
||||||
|
{"KFVIEWER", "common/kfviewer"},
|
||||||
}
|
}
|
||||||
-- For russian build, add russian-only files.
|
-- For russian build, add russian-only files.
|
||||||
if build_type == "rus" then tup.append_table(img_files, {
|
if build_type == "rus" then tup.append_table(img_files, {
|
||||||
|
BIN
data/common/kfviewer
Normal file
BIN
data/common/kfviewer
Normal file
Binary file not shown.
@ -14,6 +14,9 @@ icon=58
|
|||||||
exec=/sys/media/kiv
|
exec=/sys/media/kiv
|
||||||
icon=70
|
icon=70
|
||||||
|
|
||||||
|
[FontViewer]
|
||||||
|
exec=/sys/kfviewer
|
||||||
|
|
||||||
[Animage]
|
[Animage]
|
||||||
exec=/sys/media/animage
|
exec=/sys/media/animage
|
||||||
icon=15
|
icon=15
|
||||||
@ -67,6 +70,8 @@ exec=/sys/develop/cObj
|
|||||||
[Assoc]
|
[Assoc]
|
||||||
/=/sys/file managers/eolite
|
/=/sys/file managers/eolite
|
||||||
|
|
||||||
|
kf=$FontViewer
|
||||||
|
|
||||||
txt=$TinyPad
|
txt=$TinyPad
|
||||||
asm=$TinyPad
|
asm=$TinyPad
|
||||||
inc=$TinyPad
|
inc=$TinyPad
|
||||||
|
@ -8,15 +8,36 @@
|
|||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
proc_info Form;
|
proc_info Form;
|
||||||
|
FONT font_title = 0;
|
||||||
|
FONT font_option = 0;
|
||||||
word i, y, btn;
|
word i, y, btn;
|
||||||
char line[256], title[4196];
|
char line[256], title[4196];
|
||||||
font.no_bg_copy = true;
|
font.no_bg_copy = true;
|
||||||
font.color = 0;
|
font.color = 0;
|
||||||
font.bg_color = 0xFFFFFF;
|
font.bg_color = 0xFFFFFF;
|
||||||
|
font.left = 5;
|
||||||
|
font.top = SKIN.height+PANELH;
|
||||||
if (!param) strcpy(#param, "/sys/fonts/Tahoma.kf");
|
if (!param) strcpy(#param, "/sys/fonts/Tahoma.kf");
|
||||||
font.load(#param);
|
font.load(#param);
|
||||||
|
|
||||||
|
font_title.no_bg_copy = true;
|
||||||
|
font_title.load("/sys/fonts/Tahoma.kf");
|
||||||
|
font_title.size.text = 12;
|
||||||
|
font_title.color = 0x444444;
|
||||||
|
font_title.weight = 1;
|
||||||
|
font_title.use_smooth = 1;
|
||||||
|
font_title.bg_color = 0xE1E1E1;
|
||||||
|
|
||||||
|
font_option.no_bg_copy = true;
|
||||||
|
font_option.load("/sys/fonts/Tahoma.kf");
|
||||||
|
font_option.size.text = 13;
|
||||||
|
font_option.color = 0x222222;
|
||||||
|
font_option.use_smooth = 1;
|
||||||
|
font_option.bg_color = 0xDADADA;
|
||||||
|
|
||||||
strcpy(#title, "Kolibri font preview: ");
|
strcpy(#title, "Kolibri font preview: ");
|
||||||
strcat(#title, #param);
|
strcat(#title, #param);
|
||||||
|
font_title.prepare(5, 4, #title);
|
||||||
loop()
|
loop()
|
||||||
{
|
{
|
||||||
switch(WaitEvent())
|
switch(WaitEvent())
|
||||||
@ -29,27 +50,45 @@ void main()
|
|||||||
if (btn==4) font.smooth ^=1;
|
if (btn==4) font.smooth ^=1;
|
||||||
goto _DRAW_WINDOW_CONTENT;
|
goto _DRAW_WINDOW_CONTENT;
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
DefineAndDrawWindow(215,100,500,320,0x74,0xFFFFFF,#title);
|
DefineAndDrawWindow(215,100,500,320,0x04,0xFFFFFF,"");
|
||||||
|
font_title.show();
|
||||||
GetProcessInfo(#Form, SelfInfo);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
_DRAW_WINDOW_CONTENT:
|
_DRAW_WINDOW_CONTENT:
|
||||||
DrawBar(0, 0, Form.cwidth, PANELH, 0xCCCccc);
|
DrawBar(5, SKIN.height, Form.cwidth, PANELH, 0xDADADA);
|
||||||
CheckBox2(10, 8, 2, "Bold", font.weight);
|
|
||||||
CheckBox2(70, 8, 3, "Italic", font.italic);
|
font_option.italic = font_option.smooth = 0;
|
||||||
CheckBox2(140, 8, 4, "Smooth", font.smooth);
|
font_option.weight = 1;
|
||||||
font.buffer_size = free(font.buffer);
|
font_option.prepare(30, SKIN.height+7, "Bold");
|
||||||
|
CheckBox2(10, SKIN.height+8, 2, "", font.weight);
|
||||||
|
font_option.show();
|
||||||
|
|
||||||
|
font_option.weight = font_option.smooth = 0;
|
||||||
|
font_option.italic = 1;
|
||||||
|
font_option.prepare(90, SKIN.height+7, "Italic");
|
||||||
|
CheckBox2(70, SKIN.height+8, 3, "", font.italic);
|
||||||
|
font_option.show();
|
||||||
|
|
||||||
|
font_option.weight = font_option.italic = 0;
|
||||||
|
font_option.smooth = 1;
|
||||||
|
font_option.prepare(160, SKIN.height+7, "Smooth");
|
||||||
|
CheckBox2(140, SKIN.height+8, 4, "Smooth", font.smooth);
|
||||||
|
font_option.show();
|
||||||
|
|
||||||
|
IF(font.buffer)font.buffer_size = 0;
|
||||||
|
|
||||||
if (!font.data)
|
if (!font.data)
|
||||||
{
|
{
|
||||||
DrawBar(0, PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff);
|
DrawBar(5, SKIN.height+PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff);
|
||||||
WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded.");
|
WriteText(15, 50, 0x82, 0xFF00FF, "Font is not loaded.");
|
||||||
}
|
}
|
||||||
else for (i=10, y=5; i<22; i++, y+=font.height;) //not flexible, need to calculate font count and max line length
|
else for (i=10, y=5; i<22; i++, y+=font.height;) //not flexible, need to calculate font count and max line length
|
||||||
{
|
{
|
||||||
font.size.text = i;
|
font.size.text = i;
|
||||||
sprintf(#line,"<EFBFBD> §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i);
|
sprintf(#line,"<EFBFBD> §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i);
|
||||||
font.prepare_buf(10,y,Form.cwidth,Form.cheight-PANELH, #line);
|
font.prepare_buf(15,SKIN.height+y,Form.cwidth,Form.cheight-PANELH, #line);
|
||||||
}
|
}
|
||||||
if (font.smooth) SmoothFont(font.buffer, font.size.width, font.size.height);
|
if (font.smooth) SmoothFont(font.buffer, font.size.width, font.size.height);
|
||||||
font.show(0, PANELH);
|
font.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
byte r,g,b,weight,italic, smooth;
|
byte r,g,b,weight,italic, smooth;
|
||||||
byte width,height;
|
byte width,height;
|
||||||
byte use_smooth;
|
byte use_smooth;
|
||||||
word left,top;
|
int left,top;
|
||||||
byte encoding;
|
byte encoding;
|
||||||
dword color;
|
dword color;
|
||||||
dword file_size;
|
dword file_size;
|
||||||
@ -172,7 +172,7 @@ FONT font = 0;
|
|||||||
IF(s=='_') size.width--;
|
IF(s=='_') size.width--;
|
||||||
IF(size.offset.x<0)size.offset.x = X;
|
IF(size.offset.x<0)size.offset.x = X;
|
||||||
}
|
}
|
||||||
:dword FONT::prepare(word x,y;dword text1)
|
:dword FONT::prepare(int x,y;dword text1)
|
||||||
{
|
{
|
||||||
signed len=0;
|
signed len=0;
|
||||||
proc_info Form_SELF_FONTS;
|
proc_info Form_SELF_FONTS;
|
||||||
@ -320,16 +320,17 @@ inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; }
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
:void FONT::prepare_buf(dword x,y,w,h; dword text1)
|
:void FONT::prepare_buf(int x,y,w,h; dword text1)
|
||||||
{
|
{
|
||||||
dword c, new_buffer_size;
|
dword c, new_buffer_size;
|
||||||
c = color;
|
c = color;
|
||||||
|
//left = x;
|
||||||
IF(!text1)return;
|
IF(!text1)return;
|
||||||
IF(size.text)IF(!changeSIZE())return;
|
IF(size.text)IF(!changeSIZE())return;
|
||||||
AX = c; r = AL; g = AH; c>>=16; AX = c; b = AL;
|
AX = c; r = AL; g = AH; c>>=16; AX = c; b = AL;
|
||||||
getsize(text1);
|
getsize(text1);
|
||||||
y -= size.offset.y;
|
y -= size.offset.y;
|
||||||
|
//top = y;
|
||||||
size.width = w;
|
size.width = w;
|
||||||
size.height = h;
|
size.height = h;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user