Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 5547 → Rev 5548

/programs/cmm/ttf_viewer/compile_en.bat
0,0 → 1,11
@del lang.h--
@echo #define LANG_ENG 1 >lang.h--
 
@del ttf_viewer
cls
c-- ttf_viewer.c
@rename ttf_viewer.com ttf_viewer
@kpack ttf_viewer
@del warning.txt
@del lang.h--
@pause
/programs/cmm/ttf_viewer/compile_ru.bat
0,0 → 1,11
@del lang.h--
@echo #define LANG_RUS 1 >lang.h--
 
@del ttf_viewer
cls
c-- ttf_viewer.c
@rename ttf_viewer.com ttf_viewer
@kpack ttf_viewer
@del warning.txt
@del lang.h--
@pause
/programs/cmm/ttf_viewer/simple_open_dialog.h
0,0 → 1,14
struct od_filter
{
dword size;
byte end;
};
 
proc_info pr_inf;
char communication_area_name[] = "FFFFFFFF_open_dialog";
byte plugin_path[4096];
char open_dialog_path[] = "/rd/1/File managers/opendial"; //opendial
byte openfile_path[2048];
byte filename_area[4096];
 
opendialog o_dialog = {0, #pr_inf, #communication_area_name, 0, #plugin_path, #default_dir, #open_dialog_path, #draw_window, 0, #openfile_path, #filename_area, #filter2, 420, 200, 320, 120};
/programs/cmm/ttf_viewer/ttf_viewer.c
0,0 → 1,115
#ifndef AUTOBUILD
#include "lang.h--"
#endif
 
#define MEMSIZE 397113
#include "..\lib\kolibri.h"
#include "..\lib\strings.h"
#include "..\lib\mem.h"
#include "..\lib\file_system.h"
#include "..\lib\dll.h"
#include "..\lib\gui.h"
#include "..\lib\obj\truetype.h"
#include "..\lib\obj\proc_lib.h"
 
#include "simple_open_dialog.h"
char default_dir[] = "/rd/1";
od_filter filter2 = {"TTF",0};
 
dword font_data;
stbtt_fontinfo font_info;
dword font_mem;
 
system_colors sc;
proc_info Form;
char test_text[] = "The quick brown fox jumps over the lazy dog";
char win_title[4096] = "TTF Viewer v0.1 - ";
 
#ifdef LANG_RUS
?define T_INTRO "â® ¯à®áâ ï ¯à®£à ¬¬  ¤«ï ¯à®á¬®âà  èà¨ä⮢ ä®à¬ â  TTF"
?define T_INTRO_BUTTON_TEXT "Žâªàëâì èà¨äâ"
#else
?define T_INTRO "This is simple program to view TTF fonts."
?define T_INTRO_BUTTON_TEXT "Open font"
#endif
 
 
void main()
{
int id, key;
 
mem_Init();
if (load_dll2(libtruetype, #truetype, 1) != 0) notify("Error: library doesn't exists - truetype");
if (load_dll2(Proc_lib, #OpenDialog_init,0)!=0) notify("Error: library doesn't exists - Proc_lib (open_dialog)");
OpenDialog_init stdcall (#o_dialog);
 
if (param[0]) OpenFont(#param);
 
loop()
{
switch(WaitEvent())
{
case evButton:
id=GetButtonID();
if (id==1) ExitProcess();
if (id==10)
{
OpenDialog_start stdcall (#o_dialog);
OpenFont(#openfile_path);
}
break;
case evKey:
key = GetKey();
break;
case evReDraw:
draw_window();
}
}
}
 
 
void draw_window()
{
sc.get();
DefineAndDrawWindow(30, 100, 800, 250+GetSkinHeight(), 0x34, 0xFFFfff, #win_title);
GetProcessInfo(#Form, SelfInfo);
DrawFonts();
}
 
 
word DrawFonts()
{
if (!font_data)
{
WriteTextCenter(0,85,Form.cwidth,0x555555, T_INTRO);
DrawCaptButton(Form.cwidth - 140 / 2, Form.cheight - 30 / 2, 140, 30, 10, sc.work_button, sc.work_button_text, T_INTRO_BUTTON_TEXT);
return;
}
text_out stdcall (#test_text, #font_info, 10, 0x000000, 0xFFFfff, 3, 4);
text_out stdcall (#test_text, #font_info, 12, 0x000000, 0xFFFfff, 3, 18);
text_out stdcall (#test_text, #font_info, 24, 0x000000, 0xFFFfff, 3, 35);
text_out stdcall (#test_text, #font_info, 36, 0x000000, 0xFFFfff, 3, 60);
text_out stdcall (#test_text, #font_info, 48, 0x000000, 0xFFFfff, 3, 110);
text_out stdcall (#test_text, #font_info, 58, 0x000000, 0xFFFfff, 3, 170);
}
 
 
void OpenFont(dword font_path)
{
BDVK FontFile_atr;
GetFileInfo(font_path, #FontFile_atr);
font_data = malloc(FontFile_atr.sizelo);
ReadFile(0, FontFile_atr.sizelo, #font_data, font_path);
init_font stdcall (#font_info, #font_data);
if (EAX==0)
{
font_data = 0;
notify("'Can\096t open font: init_font failed' - E");
}
strcpy(#win_title + 18, font_path);
draw_window();
}
 
stop:
/programs/cmm/ttf_viewer/.
Property changes:
Added: tsvn:logminsize
+5
\ No newline at end of property