From ab10597e237b298029d5fcd9e7ad33f6d30b0fa5 Mon Sep 17 00:00:00 2001 From: pavelyakov Date: Thu, 5 Nov 2015 23:26:15 +0000 Subject: [PATCH] Add application kf viewer git-svn-id: svn://kolibrios.org@5884 a494cfbc-eb01-0410-851d-a64ba20cac60 --- data/Tupfile.lua | 1 + data/common/kfviewer | Bin 0 -> 3872 bytes data/common/settings/assoc.ini | 5 ++ .../kolibri font viewer/kolibri font viewer.c | 59 +++++++++++++++--- programs/cmm/lib/font.h | 9 +-- 5 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 data/common/kfviewer diff --git a/data/Tupfile.lua b/data/Tupfile.lua index e9a28afb6..f748b3964 100644 --- a/data/Tupfile.lua +++ b/data/Tupfile.lua @@ -70,6 +70,7 @@ img_files = { {"SETTINGS/NETWORK.INI", build_type .. "/settings/network.ini"}, {"NETWORK/FTPD.INI", "common/network/ftpd.ini"}, {"NETWORK/USERS.INI", "common/network/users.ini"}, + {"KFVIEWER", "common/kfviewer"}, } -- For russian build, add russian-only files. if build_type == "rus" then tup.append_table(img_files, { diff --git a/data/common/kfviewer b/data/common/kfviewer new file mode 100644 index 0000000000000000000000000000000000000000..35cc97a688bdabf99a46e349d9e25de72c17b1ac GIT binary patch literal 3872 zcmV+*58v=hP(w?|8~^}800001Mv*2LLXK;4&&M{Wk+`~HSxarD@c0p)URH|lL5gpl z>Q`0PyCtBvWyt?3C6LlzlkN4`)q9xMsNG{M`22j85%7^oTz`U;aw{mVK|Fd>479(h zK30Y{^P~HFr;mJYK#_EyYfj$8LIH`!%dng&8QR4|>N6-tLHapXH%L4y?pC!?>4VPA zOuL4x4D7(q_<x<-kMhB7(nM0Wa(J^R-xcn(><%46P0x;?$H@Xm<=HUshtyPtbyGABK33%{uett}36&^Ib9oGPdEKxxKOAG}G zqR;8QlwFshaKupNKlC=w+o$>(`42mmPg8h&gbGzfUO`4Cd9U6$qyvlpgOxMH4ElOO zU}V+5pe2Esf^`gEk&xN~ZO`iXaPv=|m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zNioI7B(KSQn|fZ;)I6pubI8t!-OWfTdsAagG@yhk$p!fuQ|G5&)?9LbZz%;ztX}5i z4_slBX=&{B5Z!lX+A@JmP`8yqFV=&ynLU8AvN{E&HM=@q(hrbLzW#ps;oV__tz>=N zHfq2SnL}CmQhwj>LK}@jel=s4_ZqK4(Am79t3wC3bb#qpc+PhX&P;)QDikWfdjq8sHLeCwo2=aAZ=L=fctXcQ{Fxm7TqD%9$5EY)Z z(5fuvUA^Xn$PWKxH~-{rgRs|Z`}vC2RjMbRRu@M$y=+V|kwg6nN4L=>qD9Y{Hstw< zhC?;2NVsHI`o>aL6hpbZ3aFolHtn1*rrx&Pt3k>(Oatuw%$dKg+#RfDS?W*3bG{dSXUvN#LK!j-!K0004&xP==4 literal 0 HcmV?d00001 diff --git a/data/common/settings/assoc.ini b/data/common/settings/assoc.ini index fee4d2a93..aae7f711a 100644 --- a/data/common/settings/assoc.ini +++ b/data/common/settings/assoc.ini @@ -14,6 +14,9 @@ icon=58 exec=/sys/media/kiv icon=70 +[FontViewer] +exec=/sys/kfviewer + [Animage] exec=/sys/media/animage icon=15 @@ -67,6 +70,8 @@ exec=/sys/develop/cObj [Assoc] /=/sys/file managers/eolite +kf=$FontViewer + txt=$TinyPad asm=$TinyPad inc=$TinyPad diff --git a/programs/cmm/kolibri font viewer/kolibri font viewer.c b/programs/cmm/kolibri font viewer/kolibri font viewer.c index eea5741d6..a05d105be 100644 --- a/programs/cmm/kolibri font viewer/kolibri font viewer.c +++ b/programs/cmm/kolibri font viewer/kolibri font viewer.c @@ -8,15 +8,36 @@ void main() { proc_info Form; + FONT font_title = 0; + FONT font_option = 0; word i, y, btn; char line[256], title[4196]; font.no_bg_copy = true; font.color = 0; font.bg_color = 0xFFFFFF; + font.left = 5; + font.top = SKIN.height+PANELH; if (!param) strcpy(#param, "/sys/fonts/Tahoma.kf"); 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: "); strcat(#title, #param); + font_title.prepare(5, 4, #title); loop() { switch(WaitEvent()) @@ -29,27 +50,45 @@ void main() if (btn==4) font.smooth ^=1; goto _DRAW_WINDOW_CONTENT; case evReDraw: - DefineAndDrawWindow(215,100,500,320,0x74,0xFFFFFF,#title); + DefineAndDrawWindow(215,100,500,320,0x04,0xFFFFFF,""); + font_title.show(); GetProcessInfo(#Form, SelfInfo); _DRAW_WINDOW_CONTENT: - DrawBar(0, 0, Form.cwidth, PANELH, 0xCCCccc); - CheckBox2(10, 8, 2, "Bold", font.weight); - CheckBox2(70, 8, 3, "Italic", font.italic); - CheckBox2(140, 8, 4, "Smooth", font.smooth); - font.buffer_size = free(font.buffer); + DrawBar(5, SKIN.height, Form.cwidth, PANELH, 0xDADADA); + + font_option.italic = font_option.smooth = 0; + font_option.weight = 1; + 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) { - DrawBar(0, PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff); - WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded."); + DrawBar(5, SKIN.height+PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff); + 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 { font.size.text = i; sprintf(#line,"Размер шрифта/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); - font.show(0, PANELH); + font.show(); } } } diff --git a/programs/cmm/lib/font.h b/programs/cmm/lib/font.h index 0c4110513..73ea68067 100644 --- a/programs/cmm/lib/font.h +++ b/programs/cmm/lib/font.h @@ -27,7 +27,7 @@ byte r,g,b,weight,italic, smooth; byte width,height; byte use_smooth; - word left,top; + int left,top; byte encoding; dword color; dword file_size; @@ -172,7 +172,7 @@ FONT font = 0; IF(s=='_') size.width--; 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; proc_info Form_SELF_FONTS; @@ -320,16 +320,17 @@ inline fastcall dword b24(EBX) { return DSDWORD[EBX] << 8; } 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; c = color; + //left = x; IF(!text1)return; IF(size.text)IF(!changeSIZE())return; AX = c; r = AL; g = AH; c>>=16; AX = c; b = AL; getsize(text1); y -= size.offset.y; - + //top = y; size.width = w; size.height = h;