Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 6805 → Rev 6806

/programs/cmm/aelia/aelia.c
88,7 → 88,7
InitDlls();
OpenDialog_init stdcall (#o_dialog);
CursorPointer.Load(#CursorFile);
label.init(DEFAULT_FONT);
kfont.init(DEFAULT_FONT);
Libimg_LoadImage(#skin, abspath("toolbar.png"));
LoadIniSettings();
list.no_selection = true;
328,9 → 328,9
 
void EventMagnifyPlus()
{
label.size.pt++;
if(!label.changeSIZE())
label.size.pt--;
kfont.size.pt++;
if(!kfont.changeSIZE())
kfont.size.pt--;
else
PreparePage();
}
337,9 → 337,9
 
void EventMagnifyMinus()
{
label.size.pt--;
if(!label.changeSIZE())
label.size.pt++;
kfont.size.pt--;
if(!kfont.changeSIZE())
kfont.size.pt++;
else
PreparePage();
}
435,7 → 435,7
}
else
{
if (!label.raw) { //this code need to be run
if (!kfont.raw) { //this code need to be run
if (param) EventOpenAddress(#param); //only once at browser sturtup
else EventOpenAddress("aelia:home");
}
448,7 → 448,7
void DrawPage()
{
list.CheckDoesValuesOkey();
if (list.count) _PutImage(list.x,list.y,list.w,list.h,list.first*list.item_h*list.w*3 + label.raw);
if (list.count) _PutImage(list.x,list.y,list.w,list.h,list.first*list.item_h*list.w*3 + kfont.raw);
DrawScroller();
}
 
/programs/cmm/aelia/ini.h
4,7 → 4,7
 
void LoadIniSettings()
{
label.size.pt = 14;
kfont.size.pt = 14;
encoding = CH_CP866;
Form.left = 150;
Form.top = 50;
12,7 → 12,7
Form.height = 560;
/*
strcpy(#ini_path, "/sys/settings/treader.ini");
ini_get_int stdcall (#ini_path, #config_section, "FontSize", 14); label.size.pt = EAX;
ini_get_int stdcall (#ini_path, #config_section, "FontSize", 14); kfont.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;
24,7 → 24,7
void SaveIniSettings()
{
/*
ini_set_int stdcall (#ini_path, #config_section, "FontSize", label.size.pt);
ini_set_int stdcall (#ini_path, #config_section, "FontSize", kfont.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/aelia/label.h
3,8 → 3,8
void get_label_symbols_size()
{
int i;
label.changeSIZE();
for (i=0; i<256; i++) char_width[i] = label.symbol_size(i);
kfont.changeSIZE();
for (i=0; i<256; i++) char_width[i] = kfont.symbol_size(i);
}
 
int get_label_len(dword _text)
23,15 → 23,15
{
char error_message[128];
if (_x > list.w) {
sprintf(#error_message, "'WriteTextIntoBuf _x overflow: H %d X %d' -A", label.size.height, _x);
sprintf(#error_message, "'WriteTextIntoBuf _x overflow: H %d X %d' -A", kfont.size.height, _x);
notify(#error_message);
}
if (_y+label.size.pt > label.size.height) {
sprintf(#error_message, "'WriteTextIntoBuf _y overflow: H %d Y %d' -A", label.size.height, _y);
if (_y+kfont.size.pt > kfont.size.height) {
sprintf(#error_message, "'WriteTextIntoBuf _y overflow: H %d Y %d' -A", kfont.size.height, _y);
notify(#error_message);
return;
}
label.WriteIntoBuffer(_x, _y, list.w, label.size.height, 0xFFFFFF, _text_col, label.size.pt, _text_off);
kfont.WriteIntoBuffer(_x, _y, list.w, kfont.size.height, 0xFFFFFF, _text_col, kfont.size.pt, _text_off);
if (_y/list.item_h-list.first==list.visible) DrawPage();
}
 
39,5 → 39,5
void label_draw_bar(dword _x, _y, _w, _color)
{
int i;
for (i = _y*list.w+_x*3+label.raw ; i<_y*list.w+_x+_w*3+label.raw ; i+=3) ESDWORD[i] = _color;
for (i = _y*list.w+_x*3+kfont.raw ; i<_y*list.w+_x+_w*3+kfont.raw ; i+=3) ESDWORD[i] = _color;
}
/programs/cmm/aelia/prepare_page.h
1,7 → 1,7
 
void PreparePage()
{
list.SetSizes(0, TOOLBAR_H, Form.cwidth-scroll.size_x-1, Form.cheight-TOOLBAR_H, label.size.pt+2);
list.SetSizes(0, TOOLBAR_H, Form.cwidth-scroll.size_x-1, Form.cheight-TOOLBAR_H, kfont.size.pt+2);
strcpy(#title, history.current()+strrchr(history.current(),'/'));
//get font chars width, need to increase performance
get_label_symbols_size();
20,7 → 20,7
}
strcat(#title, " - Aelia");
DrawTitle(#title);
DrawProgress(STEP_4_SMOOTH_FONT); label.ApplySmooth();
DrawProgress(STEP_4_SMOOTH_FONT); kfont.ApplySmooth();
DrawProgress(STEP_5_STOP); DrawPage();
}
 
57,8 → 57,8
if (draw==false) {
list.count = stroka_y/list.item_h+3;
if (list.count < list.visible) list.count = list.visible;
label.size.height = list.count+5*list.item_h;
label.raw_size = 0;
kfont.size.height = list.count+5*list.item_h;
kfont.raw_size = 0;
}
if (draw==true) WriteTextIntoBuf(8, stroka_y, 0x000000, line_start);
}
124,7 → 124,7
if (draw==true) {
if (style.a) {
link.add(stroka_x,stroka_y + size_pt_change,get_label_len(text.start),list.item_h,text.start," ");
label_draw_bar(stroka_x, stroka_y+label.size.pt+1, get_label_len(text.start), style.color);
label_draw_bar(stroka_x, stroka_y+kfont.size.pt+1, get_label_len(text.start), style.color);
}
WriteTextIntoBuf(stroka_x, stroka_y, style.color, text.start);
}
137,7 → 137,7
if (draw==true) {
if (style.a) {
link.add(stroka_x,stroka_y + size_pt_change,get_label_len(text.start),list.item_h,text.start," ");
label_draw_bar(stroka_x, stroka_y+label.size.pt+1, get_label_len(text.start), style.color);
label_draw_bar(stroka_x, stroka_y+kfont.size.pt+1, get_label_len(text.start), style.color);
}
WriteTextIntoBuf(stroka_x, stroka_y, style.color, text.start);
}
172,7 → 172,7
} else if (tag.nameis("/h3")) {
size_pt_change = -4;
}
label.size.pt += size_pt_change;
kfont.size.pt += size_pt_change;
get_label_symbols_size();
if (size_pt_change > 0) {
stroka_y+= list.item_h;//что если будет очень длинная строка в теге?
192,8 → 192,8
if (draw==false) {
list.count = stroka_y/list.item_h+3;
if (list.count < list.visible) list.count = list.visible;
label.size.height = list.count+5*list.item_h;
label.raw_size = 0;
kfont.size.height = list.count+5*list.item_h;
kfont.raw_size = 0;
}
free(DOM_start);
}
/programs/cmm/eolite/Eolite.c
708,7 → 708,7
if (text_col==0xA6A6B7) text_col=0xFFFFFF;
}
if (file.selected) text_col=0xFF0000;
if (label.size.pt==9) || (!label.font)
if (kfont.size.pt==9) || (!kfont.font)
{
if (Form.width>=480)
{
724,14 → 724,14
else
{
strcpy(#label_file_name, file_name_off);
if (label.getsize(label.size.pt, #label_file_name) + 141 + 26 > files.w)
if (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w)
{
while (label.getsize(label.size.pt, #label_file_name) + 141 + 26 > files.w) {
while (kfont.getsize(kfont.size.pt, #label_file_name) + 141 + 26 > files.w) {
ESBYTE[#label_file_name+strlen(#label_file_name)-1] = NULL;
}
strcpy(#label_file_name+strlen(#label_file_name)-2, "...");
}
label.WriteIntoWindow(files.x + 23, files.item_h - label.height / 2 + y, bgcol, text_col, label.size.pt, #label_file_name);
kfont.WriteIntoWindow(files.x + 23, files.item_h - kfont.height / 2 + y, bgcol, text_col, kfont.size.pt, #label_file_name);
}
DrawBar(files.x+files.w-141,y,1,files.item_h,system.color.work); //gray line 1
DrawBar(files.x+files.w-68,y,1,files.item_h,system.color.work); //gray line 2
/programs/cmm/eolite/include/settings.h
78,8 → 78,8
else if (id==25) { files.item_h++; files_active.item_h = files_inactive.item_h = files.item_h; }
else if (id==26) && (files.item_h>15) files_inactive.item_h = files.item_h = files.item_h-1;
else if (id==27) show_status_bar ^= 1;
else if (id==30) { label.size.pt++; IF(!label.changeSIZE()) label.size.pt--; BigFontsChange(); }
else if (id==31) { label.size.pt--; IF(!label.changeSIZE()) label.size.pt++; BigFontsChange(); }
else if (id==30) { kfont.size.pt++; IF(!kfont.changeSIZE()) kfont.size.pt--; BigFontsChange(); }
else if (id==31) { kfont.size.pt--; IF(!kfont.changeSIZE()) kfont.size.pt++; BigFontsChange(); }
EventRedrawWindow(Form.left,Form.top);
break;
116,7 → 116,7
CheckBox(x, y.inc(25), 22, NOTIFY_COPY_END, info_after_copy);
CheckBox(x, y.inc(25), 32, SHOW_BREADCRUMBS, show_breadcrumb);
CheckBox(x, y.inc(25), 24, USE_TWO_PANELS, two_panels);
MoreLessBox(x, y.inc(31), 30, 31, label.size.pt, FONT_SIZE_LABEL);
MoreLessBox(x, y.inc(31), 30, 31, kfont.size.pt, FONT_SIZE_LABEL);
MoreLessBox(x, y.inc(31), 25, 26, files.item_h, LIST_LINE_HEIGHT);
WriteText(6, y.inc(28), 0xD0, system.color.work_text, START_PATH);
path_start_ed.top = y.inc(23);
137,7 → 137,7
ini_get_int stdcall (eolite_ini_path, #config_section, "ShowStatusBar", 1); show_status_bar = EAX;
ini_get_int stdcall (eolite_ini_path, #config_section, "RealFileNamesCase", 1); real_files_names_case = EAX;
ini_get_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", 0); info_after_copy = EAX;
ini_get_int stdcall (eolite_ini_path, #config_section, "FontSize", 12); label.size.pt = EAX;
ini_get_int stdcall (eolite_ini_path, #config_section, "FontSize", 12); kfont.size.pt = EAX;
ini_get_int stdcall (eolite_ini_path, #config_section, "TwoPanels", 0); two_panels = EAX;
ini_get_int stdcall (eolite_ini_path, #config_section, "LineHeight", 19); files.item_h = EAX;
ini_get_int stdcall (eolite_ini_path, #config_section, "WinX", 200); WinX = EAX;
150,9 → 150,9
path_start_ed.pos = strlen(#path_start);
 
ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font file",#temp,4096,DEFAULT_FONT);
label.init(#temp);
kfont.init(#temp);
ini_get_str stdcall ("/sys/SETTINGS/SYSTEM.INI", "system", "font smoothing",#temp,4096,"on");
if(!strcmp(#temp,"off")) label.smooth = false; else label.smooth = true;
if(!strcmp(#temp,"off")) kfont.smooth = false; else kfont.smooth = true;
}
 
 
162,7 → 162,7
ini_set_int stdcall (eolite_ini_path, #config_section, "ShowStatusBar", show_status_bar);
ini_set_int stdcall (eolite_ini_path, #config_section, "RealFileNamesCase", real_files_names_case);
ini_set_int stdcall (eolite_ini_path, #config_section, "InfoAfterCopy", info_after_copy);
ini_set_int stdcall (eolite_ini_path, #config_section, "FontSize", label.size.pt);
ini_set_int stdcall (eolite_ini_path, #config_section, "FontSize", kfont.size.pt);
ini_set_int stdcall (eolite_ini_path, #config_section, "TwoPanels", two_panels);
ini_set_int stdcall (eolite_ini_path, #config_section, "LineHeight", files.item_h);
ini_set_int stdcall (eolite_ini_path, #config_section, "WinX", Form.left);
202,7 → 202,7
 
void BigFontsChange()
{
files.item_h = label.size.pt + 4;
files.item_h = kfont.size.pt + 4;
if (files.item_h<18) files.item_h = 18;
files_active.item_h = files_inactive.item_h = files.item_h;
}
/programs/cmm/kf_font_viewer/font_viewer.c
17,7 → 17,7
int btn;
char title[4196];
if (!param) strcpy(#param, DEFAULT_FONT);
label.init(#param);
kfont.init(#param);
tabs.active_tab=PHRASE_TAB;
strcpy(#title, "Font preview: ");
strcat(#title, #param);
26,8 → 26,8
case evButton:
btn = GetButtonID();
if (btn==1) ExitProcess();
if (btn==STRONG_BTN) label.bold ^=1;
if (btn==SMOOTH_BTN) label.smooth ^=1;
if (btn==STRONG_BTN) kfont.bold ^=1;
if (btn==SMOOTH_BTN) kfont.smooth ^=1;
if (btn==PHRASE_TAB) || (btn==CHARS_TAB) tabs.click(btn);
goto _DRAW_WINDOW_CONTENT;
case evReDraw:
37,12 → 37,12
if (Form.status_window>2) break;
_DRAW_WINDOW_CONTENT:
DrawBar(0, 0, Form.cwidth, PANELH-1, system.color.work);
CheckBox(10, 8, STRONG_BTN, "Bold", label.bold);
CheckBox(83,8, SMOOTH_BTN, "Smooth", label.smooth);
CheckBox(10, 8, STRONG_BTN, "Bold", kfont.bold);
CheckBox(83,8, SMOOTH_BTN, "Smooth", kfont.smooth);
tabs.draw(Form.cwidth-150, PANELH, PHRASE_TAB, "Phrase");
tabs.draw(Form.cwidth-70, PANELH, CHARS_TAB, "Chars");
DrawBar(0, PANELH-1,Form.cwidth,1,system.color.work_graph);
if (!label.font)
if (!kfont.font)
{
DrawBar(0, PANELH, Form.cwidth, Form.cheight - PANELH, 0xFFFfff);
WriteText(10, 50, 0x82, 0xFF00FF, "Font is not loaded.");
57,14 → 57,14
{
dword i, y;
char line[256];
label.raw_size = free(label.raw);
for (i=10, y=5; i<22; i++, y+=label.height;) //not flexible, need to calculate font count and max line length
kfont.raw_size = free(kfont.raw);
for (i=10, y=5; i<22; i++, y+=kfont.height;) //not flexible, need to calculate font count and max line length
{
sprintf(#line," §¬¥à èà¨äâ /size font %d ¯¨ªá¥«¥©.",i);
label.WriteIntoBuffer(10,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, i, #line);
kfont.WriteIntoBuffer(10,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, i, #line);
}
if (label.smooth) label.ApplySmooth();
label.ShowBuffer(0, PANELH);
if (kfont.smooth) kfont.ApplySmooth();
kfont.ShowBuffer(0, PANELH);
}
 
void DrawPreviewChars()
72,17 → 72,17
dword i, x=20, y=0;
char line[2];
line[1]=NULL;
label.raw_size = free(label.raw);
kfont.raw_size = free(kfont.raw);
for (i=0; i<255; i++) //not flexible, need to calculate font count and max line length
{
line[0]=i;
label.WriteIntoBuffer(x,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, 16, #line);
x+= label.height+2;
kfont.WriteIntoBuffer(x,y,Form.cwidth,Form.cheight-PANELH, 0xFFFFFF, 0, 16, #line);
x+= kfont.height+2;
if (x>=Form.cwidth-30) {
x=20;
y+=label.height+2;
y+=kfont.height+2;
}
}
if (label.smooth) label.ApplySmooth();
label.ShowBuffer(0, PANELH);
if (kfont.smooth) kfont.ApplySmooth();
kfont.ShowBuffer(0, PANELH);
}
/programs/cmm/lib/kfont.h
31,7 → 31,7
dword raw;
dword raw_size;
 
byte init();
bool init();
bool changeSIZE();
byte symbol();
byte symbol_size();
42,7 → 42,7
int WriteIntoWindowCenter();
void WriteIntoBuffer();
void ShowBuffer();
} label;
} kfont;
 
:bool LABEL::changeSIZE()
{
59,6 → 59,7
block = math.ceil(height*width/32);
return true;
}
 
:dword LABEL::getsize(byte fontSizePoints, dword text1)
{
size.height = size.width = 0;
67,7 → 68,7
if(size.pt)if(!changeSIZE())return 0;
WHILE(DSBYTE[text1])
{
symbol_size(DSBYTE[text1]);
size.width += symbol_size(DSBYTE[text1]);
text1++;
}
$neg size.offset_y
76,84 → 77,59
size.width += size.offset_x+1;
return size.width;
}
 
:byte LABEL::symbol_size(byte s)
{
//return symbol_size(s);
dword xi,yi;
dword tmp,_;
dword iii = 0;
byte rw=0;
byte X;
if(bold) size.width+=math.ceil(size.pt/17);
if(s==32)
{
size.width += width/4;
return;
int chaw_width;
chaw_width = symbol(0,0, s, 0);
if(bold) chaw_width += math.ceil(size.pt/17);
return chaw_width;
}
if(s==9)
{
size.width += width;
return;
}
s = Cp866ToAnsi(s);
tmp = block*s << 2 + font;
for(yi=0; yi<height; yi++)
{
for(xi=0; xi<width; xi++)
{
if(iii%32) _ >>= 1;
else
{
tmp += 4;
_ = DSDWORD[tmp];
}
if(_&1)
{
if(xi>rw)rw=xi;
if(size.height<yi)size.height = yi;
if(size.offset_y<0)size.offset_y = yi;
else if(yi<size.offset_y)size.offset_y = yi;
if(!X) X = xi;
else if(X>xi)X = xi;
}
iii++;
}
}
size.width += rw;
if(size.offset_x<0)size.offset_x = X;
}
 
:byte LABEL::symbol(signed x,y; byte s; dword image_raw)
{
dword xi,yi;
dword iii = 0;
dword offs;
byte rw=0;
dword tmp, _;
byte X;
byte chaw_width=0;
if(s==32)return width/4;
if(s==9)return width;
s = Cp866ToAnsi(s);
EBX = block*s << 2 + font;
tmp = block*s << 2 + font;
for(yi=0; yi<height; yi++)
{
EDI = size.offset_y + yi + y * size.width * 3 + image_raw;
for(xi=0; xi<width; xi++)
{
if(iii%32) $shr ecx,1
if(iii%32) _ >>= 1;
else
{
EBX += 4;
ECX = DSDWORD[EBX];
tmp += 4;
_ = DSDWORD[tmp];
}
if(ECX&true)
if(_&1) //check does the pixel set
{
if(xi>rw)rw=xi;
if(xi>chaw_width)chaw_width=xi;
if (image_raw)
{
offs = x + xi *3 + EDI;
DSDWORD[offs] = DSDWORD[offs] & 0xFF000000 | color;
if(bold) DSDWORD[offs+3] = DSDWORD[offs+3] & 0xFF000000 | color;
}
else
{
if(size.height<yi)size.height = yi;
if(size.offset_y<0)size.offset_y = yi; else if(yi<size.offset_y)size.offset_y = yi;
if(!X) X = xi; else if(X>xi)X = xi;
if(size.offset_x<0)size.offset_x = X;
}
}
iii++;
}
}
return rw;
return chaw_width;
}
 
inline fastcall Cp866ToAnsi(AL) {
168,7 → 144,7
return AL;
}
 
:byte LABEL::init(dword font_path)
:bool LABEL::init(dword font_path)
{
IO label_io;
if(font)free(font);
206,7 → 182,7
// wb
if(b24(i)!=background) && (b24(i+3)==background) && (b24(i+line_w)==background) && (b24(i+3+line_w)!=background)
{
dark_background = MixColors(background,b24(i),210);
dark_background = MixColors(background,b24(i),200);
DSDWORD[i+3] = DSDWORD[i+3] & 0xFF000000 | dark_background;
DSDWORD[i+line_w] = DSDWORD[i+line_w] & 0xFF000000 | dark_background;
}
214,7 → 190,7
// bw
else if(b24(i)==background) && (b24(i+3)!=background) && (b24(i+line_w)!=background) && (b24(i+3+line_w)==background)
{
dark_background = MixColors(background,b24(i+3),210);
dark_background = MixColors(background,b24(i+3),200);
DSDWORD[i] = DSDWORD[i] & 0xFF000000 | dark_background;
DSDWORD[i+3+line_w] = DSDWORD[i+3+line_w] & 0xFF000000 | dark_background;
}
280,5 → 256,4
}
 
 
 
#endif
/programs/cmm/software_widget/software_widget.c
51,7 → 51,7
void main()
{
dword id;
label.init(DEFAULT_FONT);
kfont.init(DEFAULT_FONT);
load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1);
load_dll(libini, #lib_init,1);
135,8 → 135,8
img_draw stdcall(skin.image, col*list.item_w+tmp-10, row*list.item_h+5 + list_pos, 32, 32, 0, icon_id*32);
if (icon_char_pos) ESBYTE[icon_char_pos] = '\0'; //delete icon from string
app_path_collection.add(key_value);
//label.WriteIntoWindowCenter(col*list.item_w+7,row*list.item_h+47 + list_pos, list.item_w,0, LIST_BACKGROUND_COLOR, 0xDCDCDC, 12, key_name);
label.WriteIntoWindowCenter(col*list.item_w+6,row*list.item_h+46 + list_pos, list.item_w,0, LIST_BACKGROUND_COLOR, 0x000000, 12, key_name);
//kfont.WriteIntoWindowCenter(col*list.item_w+7,row*list.item_h+47 + list_pos, list.item_w,0, LIST_BACKGROUND_COLOR, 0xDCDCDC, 12, key_name);
kfont.WriteIntoWindowCenter(col*list.item_w+6,row*list.item_h+46 + list_pos, list.item_w,0, LIST_BACKGROUND_COLOR, 0x000000, 12, key_name);
if (list.cur_y == list.count) DrawWideRectangle(col*list.item_w+6, row*list.item_h + list_pos,list.item_w,list.item_h-5, 2, 0x0080FF);
list.count++;
col++;
161,7 → 161,7
col = 0;
old_row = row;
DrawBar(0, row * list.item_h + list_pos, Form.cwidth , 29, LIST_BACKGROUND_COLOR);
text_len = label.WriteIntoWindow(10, row * list.item_h + 10 + list_pos, LIST_BACKGROUND_COLOR, 0, 15, sec_name);
text_len = kfont.WriteIntoWindow(10, row * list.item_h + 10 + list_pos, LIST_BACKGROUND_COLOR, 0, 15, sec_name);
DrawBar(text_len+20, row * list.item_h + list_pos + 20, Form.cwidth-text_len-20, 1, 0xDCDCDC);
DrawBar(text_len+20, row * list.item_h + list_pos + 21, Form.cwidth-text_len-20, 1, 0xFCFCFC);
list_pos += 29;
174,7 → 174,7
DrawBar(0,0,Form.cwidth, list.y-2, system.color.work);
DrawBar(0,list.y-2, Form.cwidth, 1, MixColors(system.color.work, system.color.work_graph, 180));
DrawBar(0,list.y-1, Form.cwidth, 1, system.color.work_graph);
label.WriteIntoWindowCenter(0,5, Form.cwidth, list.y, system.color.work, system.color.work_text, 16, #window_title);
kfont.WriteIntoWindowCenter(0,5, Form.cwidth, list.y, system.color.work, system.color.work_text, 16, #window_title);
}
 
void EventRunApp(dword appid)
/programs/cmm/txtread/ini.h
5,7 → 5,7
void LoadIniSettings()
{
strcpy(#ini_path, "/sys/settings/txtread.ini");
ini_get_int stdcall (#ini_path, #config_section, "FontSize", 14); label.size.pt = EAX;
ini_get_int stdcall (#ini_path, #config_section, "FontSize", 14); kfont.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", label.size.pt);
ini_set_int stdcall (#ini_path, #config_section, "FontSize", kfont.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/txtread/prepare_page.h
37,7 → 37,7
if (mode==DRAW_BUF) {
EBX = bufoff-line_start;
strlcpy(#line, line_start, EBX);
label.WriteIntoBuffer(8,stroka_y,list.w,label.size.height, 0xFFFFFF, 0, label.size.pt, #line);
kfont.WriteIntoBuffer(8,stroka_y,list.w,kfont.size.height, 0xFFFFFF, 0, kfont.size.pt, #line);
stroka_y += list.item_h;
line_start = bufoff;
line_length = 30;
45,7 → 45,7
}
}
if (mode==COUNT_BUF_HEIGHT) list.count+=2;
if (mode==DRAW_BUF) label.WriteIntoBuffer(8,stroka_y,list.w,label.size.height, 0xFFFFFF, 0, label.size.pt, line_start);
if (mode==DRAW_BUF) kfont.WriteIntoBuffer(8,stroka_y,list.w,kfont.size.height, 0xFFFFFF, 0, kfont.size.pt, line_start);
}
 
void PreparePage()
52,8 → 52,8
{
//get font chars width, need to increase performance
int i;
label.changeSIZE();
for (i=0; i<256; i++) char_width[i] = label.symbol_size(i);
kfont.changeSIZE();
for (i=0; i<256; i++) char_width[i] = kfont.symbol_size(i);
 
//get font buffer height
list.w = Form.cwidth-scroll.size_x-1;
61,13 → 61,13
Parcer(COUNT_BUF_HEIGHT);
//draw text in buffer
list.SetSizes(0, TOOLBAR_H, list.w, Form.cheight-TOOLBAR_H, label.size.pt+3);
list.SetSizes(0, TOOLBAR_H, list.w, Form.cheight-TOOLBAR_H, kfont.size.pt+4);
if (list.count < list.visible) list.count = list.visible;
label.size.height = list.count+1*list.item_h;
label.raw_size = 0;
kfont.size.height = list.count+1*list.item_h;
kfont.raw_size = 0;
Parcer(DRAW_BUF);
 
//draw result
label.ApplySmooth();
kfont.ApplySmooth();
DrawPage();
}
/programs/cmm/txtread/txtread.c
72,7 → 72,7
{
InitDlls();
OpenDialog_init stdcall (#o_dialog);
label.init(DEFAULT_FONT);
kfont.init(DEFAULT_FONT);
Libimg_LoadImage(#skin, abspath("toolbar.png"));
LoadIniSettings();
OpenFile(#param);
202,9 → 202,9
 
void EventMagnifyPlus()
{
label.size.pt++;
if(!label.changeSIZE())
label.size.pt--;
kfont.size.pt++;
if(!kfont.changeSIZE())
kfont.size.pt--;
else
PreparePage();
}
211,9 → 211,9
 
void EventMagnifyMinus()
{
label.size.pt--;
if(!label.changeSIZE())
label.size.pt++;
kfont.size.pt--;
if(!kfont.changeSIZE())
kfont.size.pt++;
else
PreparePage();
}
291,6 → 291,6
 
void DrawPage()
{
_PutImage(list.x,list.y,list.w,list.h,list.first*list.item_h*list.w*3 + label.raw);
_PutImage(list.x,list.y,list.w,list.h,list.first*list.item_h*list.w*3 + kfont.raw);
DrawScroller();
}