Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 5986 → Rev 5987

/programs/cmm/textreader/ini.h
5,7 → 5,7
void LoadIniSettings()
{
strcpy(#ini_path, "/sys/settings/treader.ini");
ini_get_int stdcall (#ini_path, #config_section, "FontSize", 14); font.size.text = EAX;
ini_get_int stdcall (#ini_path, #config_section, "FontSize", 14); label.size.pt = EAX;
ini_get_int stdcall (#ini_path, #config_section, "Encoding", CH_CP866); encoding = EAX;
ini_get_int stdcall (#ini_path, #config_section, "WinX", 150); Form.left = EAX;
ini_get_int stdcall (#ini_path, #config_section, "WinY", 50); Form.top = EAX;
15,7 → 15,7
 
void SaveIniSettings()
{
ini_set_int stdcall (#ini_path, #config_section, "FontSize", font.size.text);
ini_set_int stdcall (#ini_path, #config_section, "FontSize", label.size.pt);
ini_set_int stdcall (#ini_path, #config_section, "Encoding", encoding);
ini_set_int stdcall (#ini_path, #config_section, "WinX", Form.left);
ini_set_int stdcall (#ini_path, #config_section, "WinY", Form.top);
/programs/cmm/textreader/prepare_page.h
10,10 → 10,10
dword stroka=0;
int i, srch_pos;
font.changeSIZE();
label.changeSIZE();
list.w = Form.cwidth-scroll.size_x-1;
//get font chars width, need to increase performance
for (i=0; i<256; i++) char_width[i] = font.symbol_size(i);
for (i=0; i<256; i++) char_width[i] = label.symbol_size(i);
//get font buffer height
for (bufoff=io.buffer_data; ESBYTE[bufoff]; bufoff++)
{
34,11 → 34,11
}
//draw text in buffer
list.count = stroka+2;
list.SetSizes(0, TOOLBAR_H, list.w, Form.cheight-TOOLBAR_H, font.size.text+1);
list.SetSizes(0, TOOLBAR_H, list.w, Form.cheight-TOOLBAR_H, label.size.pt+1);
if (list.count < list.visible) list.count = list.visible;
 
font.size.height = list.count+1*list.item_h;
font.buffer_size = 0;
label.size.height = list.count+1*list.item_h;
label.raw_size = 0;
 
line_length = 30;
line_start = io.buffer_data;
58,13 → 58,13
}
i = bufoff-line_start;
strlcpy(#line, line_start, i);
font.write_buf(8,stroka_y,list.w,font.size.height, #line);
label.write_buf(8,stroka_y,list.w,label.size.height, 0xFFFFFF, 0, label.size.pt, #line);
stroka_y += list.item_h;
line_start = bufoff;
line_length = 30;
}
}
font.write_buf(8,stroka_y,list.w,font.size.height, line_start);
font.apply_smooth();
label.write_buf(8,stroka_y,list.w,label.size.height, 0xFFFFFF, 0, label.size.pt, line_start);
label.apply_smooth();
DrawPage();
}
/programs/cmm/textreader/textreader.c
15,11 → 15,10
#define TOOLBAR_ICON_WIDTH 26
#define TOOLBAR_ICON_HEIGHT 24
 
#define DEFAULT_FONT "/sys/fonts/Tahoma.kf"
#define DEFAULT_EDITOR "/sys/tinypad"
 
#define INTRO_TEXT "This is a plain Text Reader.\nTry to open some text file."
#define VERSION "Text Reader v1.04"
#define VERSION "Text Reader v1.05"
#define ABOUT "Idea: Leency, punk_joker
Code: Leency, Veliant, KolibriOS Team
 
72,23 → 71,10
void main()
{
InitDlls();
OpenDialog_init stdcall (#o_dialog);
font.color = 0;
font.bg_color = 0xFFFFFF;
font.load(DEFAULT_FONT);
if (!font.data) {
io.run("/sys/@notify","'Error: Font is not loaded.' -E");
ExitProcess();
}
label.init(DEFAULT_FONT);
Libimg_LoadImage(#skin, abspath("toolbar.png"));
LoadIniSettings();
OpenFile(#param);
list.no_selection = true;
SetEventMask(10000000000000000000000001100111b);
215,9 → 201,9
 
void EventMagnifyPlus()
{
font.size.text++;
if(!font.changeSIZE())
font.size.text--;
label.size.pt++;
if(!label.changeSIZE())
label.size.pt--;
else
PreparePage();
}
224,9 → 210,9
 
void EventMagnifyMinus()
{
font.size.text--;
if(!font.changeSIZE())
font.size.text++;
label.size.pt--;
if(!label.changeSIZE())
label.size.pt++;
else
PreparePage();
}
303,6 → 289,6
 
void DrawPage()
{
_PutImage(list.x,list.y,list.w,list.h,list.first*list.item_h*list.w*3 + font.buffer);
_PutImage(list.x,list.y,list.w,list.h,list.first*list.item_h*list.w*3 + label.raw);
DrawScroller();
}