From b380ebc490039e27b46438ce363872109d708a60 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 21 Nov 2016 20:25:00 +0000 Subject: [PATCH] cmm: decrease size of apps a bit git-svn-id: svn://kolibrios.org@6735 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/TWB/TWB.c | 24 +++++++------------ programs/cmm/TWB/img_cache.h | 1 - programs/cmm/eolite/Eolite.c | 11 +++------ programs/cmm/lib/file_system.h | 2 +- programs/cmm/lib/keyboard.h | 6 ++--- programs/cmm/lib/kolibri.h | 18 +++++++++----- .../cmm/software_widget/software_widget.c | 2 +- programs/cmm/vfc/vfc_gui.h | 2 +- 8 files changed, 29 insertions(+), 37 deletions(-) diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c index b0d8b28835..125a121454 100644 --- a/programs/cmm/TWB/TWB.c +++ b/programs/cmm/TWB/TWB.c @@ -157,7 +157,7 @@ void TWebBrowser::Prepare(){ break; } case '\9': - if (style.pre) //иначе идём на 0x0d + if (style.pre) //otherwise go to 0x0d { tab_len = strlen(#line) % 4; if (!tab_len) tab_len = 4; @@ -183,7 +183,7 @@ void TWebBrowser::Prepare(){ bufpos++; } tag = attr = tagparam = ignor_param = NULL; - while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //получаем тег и его параметры + while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì ГІГҐГЈ ГЁ ГҐГЈГ® ïàðàìåòðû { bukva = ESBYTE[bufpos]; if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; @@ -205,7 +205,7 @@ void TWebBrowser::Prepare(){ Perenos(); DrawStyle(); line = NULL; - if (tag) SetStyle(); //обработка тегов + if (tag) SetStyle(); strlcpy(#oldtag, #tag, sizeof(oldtag)); tag = attr = tagparam = ignor_param = NULL; break; @@ -226,7 +226,7 @@ void TWebBrowser::Prepare(){ NewLine(); DrawPage(); if (list.first == 0) list.count = stroka; - if (anchor) //если посреди текста появится новый якорь - будет бесконечный цикл + if (anchor) { anchor=NULL; list.first=anchor_line_num; @@ -253,7 +253,6 @@ void TWebBrowser::SetStyle() { int top1 = stroka * list.item_h + list.y + 5; byte opened; byte meta_encoding; - //проверяем тег открывается или закрывается if (tag[0] == '/') { opened = 0; @@ -268,7 +267,7 @@ void TWebBrowser::SetStyle() { if (istag("form")) if (!opened) ignor_text = false; if(istag("title")) { if (opened) header=NULL; - else if (!stroka) DrawTitle(#header); //тег закрылся - вывели строку + else if (!stroka) DrawTitle(#header); return; } if (ignor_text) return; @@ -279,7 +278,7 @@ void TWebBrowser::SetStyle() { if (!opened) strcat(#line, "\" "); return; } - if (anchor) && (isattr("id=")) { //очень плохо!!! потому что если не последний тег, работать не будет + if (anchor) if (isattr("id=")) || (isattr("name=")) { //very bad: if the tag is not the last it wound work if (!strcmp(#anchor, #val)) anchor_line_num=list.first+stroka; } if (istag("body")) { @@ -300,7 +299,7 @@ void TWebBrowser::SetStyle() { if (istag("a")) { if (opened) { - if (link) IF(text_color_index > 0) text_color_index--; //если предыдущий тег а не был закрыт + if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé ГІГҐГЈ Г  Г­ГҐ áûë çàêðûò do{ if (isattr("href=")) && (!strstr(#val,"javascript:")) { @@ -310,13 +309,6 @@ void TWebBrowser::SetStyle() { text_colors[text_color_index] = link_color_inactive; PageLinks.AddLink(#val, DrawBuf.zoom * stolbec * list.font_w + left1, top1-DrawBuf.zoom); } - if (anchor) && (isattr("name=")) - { - if (!strcmp(#anchor, #val)) - { - anchor_line_num=list.first+stroka; - } - } } while(GetNextParam()); } else { @@ -419,7 +411,7 @@ void TWebBrowser::SetStyle() { do{ if (isattr("charset=")) || (isattr("content=")) || (isattr("encoding=")) { - strcpy(#val, #val[strrchr(#val, '=')]); //поиск в content= + strcpy(#val, #val[strrchr(#val, '=')]); //search in content= strlwr(#val); if (isval("utf-8")) || (isval("utf8")) meta_encoding = CH_UTF8; else if (isval("koi8-r")) || (isval("koi8-u")) meta_encoding = CH_KOI8; diff --git a/programs/cmm/TWB/img_cache.h b/programs/cmm/TWB/img_cache.h index c88fcfa531..b2516a3d24 100644 --- a/programs/cmm/TWB/img_cache.h +++ b/programs/cmm/TWB/img_cache.h @@ -82,7 +82,6 @@ void ImageCache::Images(int left1, top1, width1) imgh=WB1.list.y+WB1.list.h-top1-5; } if (imgh<=0) return; - if (anchor) return; img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first); DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, bg_color); diff --git a/programs/cmm/eolite/Eolite.c b/programs/cmm/eolite/Eolite.c index ba9f59f309..03005d387c 100644 --- a/programs/cmm/eolite/Eolite.c +++ b/programs/cmm/eolite/Eolite.c @@ -71,7 +71,6 @@ int count_dir; byte path[4096], - DefaultPath[4096], file_path[4096], file_name[256], new_element_name[256], @@ -91,7 +90,6 @@ int mouse_dd, sc_slider_h; int j, i; int action_buf; int rand_n; -byte CMD_REFRESH; //struct t_settings { char sort_num=2; @@ -134,10 +132,7 @@ void main() dword id; byte count_sl = 0; signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; - char can_show, can_select, stats; - dword selected_offset; - dword IPC_LEN,IPC_ID; - char IPC_BUF[10]; + char stats; rand_n = random(40); load_dll(boxlib, #box_lib_init,0); @@ -410,7 +405,7 @@ void main() break; case 049: //Ctrl+N - create new window if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); - RunProgram("/sys/File Managers/Eolite", #path); + RunProgram(I_Path, #path); break; case 050: //Ctrl+M Open_Dir(#inactive_path,WITH_REDRAW); @@ -881,7 +876,7 @@ void Open(byte rez) { if (!strncmp(#file_name,"..",3)) return; strcpy(#temp, #file_path); - RunProgram("/sys/File Managers/Eolite", #temp); + RunProgram(I_Path, #temp); return; } if (!files.count) return; diff --git a/programs/cmm/lib/file_system.h b/programs/cmm/lib/file_system.h index d608b927d2..f19696869b 100644 --- a/programs/cmm/lib/file_system.h +++ b/programs/cmm/lib/file_system.h @@ -278,7 +278,7 @@ enum } else { - strcpy(#absolute_path, #program_path); + strcpy(#absolute_path, I_Path); absolute_path[strrchr(#absolute_path, '/')] = '\0'; strcat(#absolute_path, relative_path); } diff --git a/programs/cmm/lib/keyboard.h b/programs/cmm/lib/keyboard.h index 4ecbe18647..39c0581d8a 100644 --- a/programs/cmm/lib/keyboard.h +++ b/programs/cmm/lib/keyboard.h @@ -70,9 +70,9 @@ GETKEYII: $shr eax,8 } -unsigned char key_ascii; -dword key_scancode, key_modifier, key_editbox; -int GetKeys() +:unsigned char key_ascii; +:dword key_scancode, key_modifier, key_editbox; +:int GetKeys() { $push edx GETKEY: diff --git a/programs/cmm/lib/kolibri.h b/programs/cmm/lib/kolibri.h index 1bf51e5a7c..f3bd13873a 100644 --- a/programs/cmm/lib/kolibri.h +++ b/programs/cmm/lib/kolibri.h @@ -360,22 +360,24 @@ inline fastcall void DrawTitle( ECX) $int 0x40; } -void WriteTextB(dword x,y,byte fontType, dword color, EDX) +:void WriteTextB(dword x,y,byte fontType, dword color, str_offset) { EAX = 4; EBX = x<<16+y; ECX = fontType<<24+color; + EDX = str_offset; ESI = 0; $int 0x40; $add ebx, 1<<16 $int 0x40 } -void WriteText(dword x,y,byte fontType, dword color, EDX) +:void WriteText(dword x,y,byte fontType, dword color, str_offset) { EAX = 4; EBX = x<<16+y; ECX = fontType<<24+color; + EDX = str_offset; $int 0x40; } @@ -387,18 +389,20 @@ dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI) $int 0x40; } -void WriteNumber(dword x,y,byte fontType, dword color, count, ECX) +void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset) { EAX = 47; EBX = count<<16; + ECX = number_or_offset; EDX = x<<16+y; ESI = fontType<<24+color; $int 0x40; } -void CopyScreen(dword EBX, x, y, w, h) +:void CopyScreen(dword dst_offset, x, y, w, h) { EAX = 36; + EBX = dst_offset; ECX = w << 16 + h; EDX = x << 16 + y; $int 0x40; @@ -411,10 +415,10 @@ void CopyScreen(dword EBX, x, y, w, h) $int 0x40 } - -void _PutImage(dword x,y, w,h, EBX) +:void _PutImage(dword x,y, w,h, data_offset) { EAX = 7; + EBX = data_offset; ECX = w<<16+h; EDX = x<<16+y; $int 0x40 @@ -610,6 +614,8 @@ void ______INIT______() mem_init(); + if (program_path[0]!='/') I_Path++; + main(); ExitProcess(); } diff --git a/programs/cmm/software_widget/software_widget.c b/programs/cmm/software_widget/software_widget.c index f4ed4f53c6..1abc9cb68f 100644 --- a/programs/cmm/software_widget/software_widget.c +++ b/programs/cmm/software_widget/software_widget.c @@ -66,7 +66,7 @@ void main() } else { - strcat(#settings_ini_path, #program_path + strrchr(#program_path, '/')); + strcat(#settings_ini_path, I_Path + strrchr(I_Path, '/')); strcat(#settings_ini_path, ".ini"); } diff --git a/programs/cmm/vfc/vfc_gui.h b/programs/cmm/vfc/vfc_gui.h index 7a2e5c74fa..262170a4dc 100644 --- a/programs/cmm/vfc/vfc_gui.h +++ b/programs/cmm/vfc/vfc_gui.h @@ -59,7 +59,7 @@ void gui() break; case BID_COMPARE: sprintf(#run_param, "\"%s\" \"%s\"", #src_box_text, #dst_box_text); - io.run(#program_path+1, #run_param); + io.run(I_Path, #run_param); break; } break;