cmm: decrease size of apps a bit

git-svn-id: svn://kolibrios.org@6735 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-11-21 20:25:00 +00:00
parent 64b1d5344a
commit b380ebc490
8 changed files with 29 additions and 37 deletions

View File

@ -157,7 +157,7 @@ void TWebBrowser::Prepare(){
break; break;
} }
case '\9': case '\9':
if (style.pre) //иначе идём на 0x0d if (style.pre) //otherwise go to 0x0d
{ {
tab_len = strlen(#line) % 4; tab_len = strlen(#line) % 4;
if (!tab_len) tab_len = 4; if (!tab_len) tab_len = 4;
@ -183,7 +183,7 @@ void TWebBrowser::Prepare(){
bufpos++; bufpos++;
} }
tag = attr = tagparam = ignor_param = NULL; tag = attr = tagparam = ignor_param = NULL;
while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //получаем тег и его параметры while (ESBYTE[bufpos] !='>') && (bufpos < bufpointer + bufsize) //ïîëó÷àåì òåã è åãî ïàðàìåòðû
{ {
bukva = ESBYTE[bufpos]; bukva = ESBYTE[bufpos];
if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' '; if (bukva == '\9') || (bukva == '\x0a') || (bukva == '\x0d') bukva = ' ';
@ -205,7 +205,7 @@ void TWebBrowser::Prepare(){
Perenos(); Perenos();
DrawStyle(); DrawStyle();
line = NULL; line = NULL;
if (tag) SetStyle(); //обработка тегов if (tag) SetStyle();
strlcpy(#oldtag, #tag, sizeof(oldtag)); strlcpy(#oldtag, #tag, sizeof(oldtag));
tag = attr = tagparam = ignor_param = NULL; tag = attr = tagparam = ignor_param = NULL;
break; break;
@ -226,7 +226,7 @@ void TWebBrowser::Prepare(){
NewLine(); NewLine();
DrawPage(); DrawPage();
if (list.first == 0) list.count = stroka; if (list.first == 0) list.count = stroka;
if (anchor) //если посреди текста появится новый якорь - будет бесконечный цикл if (anchor)
{ {
anchor=NULL; anchor=NULL;
list.first=anchor_line_num; list.first=anchor_line_num;
@ -253,7 +253,6 @@ void TWebBrowser::SetStyle() {
int top1 = stroka * list.item_h + list.y + 5; int top1 = stroka * list.item_h + list.y + 5;
byte opened; byte opened;
byte meta_encoding; byte meta_encoding;
//проверяем тег открывается или закрывается
if (tag[0] == '/') if (tag[0] == '/')
{ {
opened = 0; opened = 0;
@ -268,7 +267,7 @@ void TWebBrowser::SetStyle() {
if (istag("form")) if (!opened) ignor_text = false; if (istag("form")) if (!opened) ignor_text = false;
if(istag("title")) { if(istag("title")) {
if (opened) header=NULL; if (opened) header=NULL;
else if (!stroka) DrawTitle(#header); //тег закрылся - вывели строку else if (!stroka) DrawTitle(#header);
return; return;
} }
if (ignor_text) return; if (ignor_text) return;
@ -279,7 +278,7 @@ void TWebBrowser::SetStyle() {
if (!opened) strcat(#line, "\" "); if (!opened) strcat(#line, "\" ");
return; 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 (!strcmp(#anchor, #val)) anchor_line_num=list.first+stroka;
} }
if (istag("body")) { if (istag("body")) {
@ -300,7 +299,7 @@ void TWebBrowser::SetStyle() {
if (istag("a")) { if (istag("a")) {
if (opened) if (opened)
{ {
if (link) IF(text_color_index > 0) text_color_index--; //если предыдущий тег а не был закрыт if (link) IF(text_color_index > 0) text_color_index--; //åñëè ïðåäûäóùèé òåã à íå áûë çàêðûò
do{ do{
if (isattr("href=")) && (!strstr(#val,"javascript:")) if (isattr("href=")) && (!strstr(#val,"javascript:"))
{ {
@ -310,13 +309,6 @@ void TWebBrowser::SetStyle() {
text_colors[text_color_index] = link_color_inactive; text_colors[text_color_index] = link_color_inactive;
PageLinks.AddLink(#val, DrawBuf.zoom * stolbec * list.font_w + left1, top1-DrawBuf.zoom); 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()); } while(GetNextParam());
} }
else { else {
@ -419,7 +411,7 @@ void TWebBrowser::SetStyle() {
do{ do{
if (isattr("charset=")) || (isattr("content=")) || (isattr("encoding=")) if (isattr("charset=")) || (isattr("content=")) || (isattr("encoding="))
{ {
strcpy(#val, #val[strrchr(#val, '=')]); //поиск в content= strcpy(#val, #val[strrchr(#val, '=')]); //search in content=
strlwr(#val); strlwr(#val);
if (isval("utf-8")) || (isval("utf8")) meta_encoding = CH_UTF8; if (isval("utf-8")) || (isval("utf8")) meta_encoding = CH_UTF8;
else if (isval("koi8-r")) || (isval("koi8-u")) meta_encoding = CH_KOI8; else if (isval("koi8-r")) || (isval("koi8-u")) meta_encoding = CH_KOI8;

View File

@ -82,7 +82,6 @@ void ImageCache::Images(int left1, top1, width1)
imgh=WB1.list.y+WB1.list.h-top1-5; imgh=WB1.list.y+WB1.list.h-top1-5;
} }
if (imgh<=0) return; if (imgh<=0) return;
if (anchor) return;
img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first); 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); DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, bg_color);

View File

@ -71,7 +71,6 @@ int count_dir;
byte byte
path[4096], path[4096],
DefaultPath[4096],
file_path[4096], file_path[4096],
file_name[256], file_name[256],
new_element_name[256], new_element_name[256],
@ -91,7 +90,6 @@ int mouse_dd, sc_slider_h;
int j, i; int j, i;
int action_buf; int action_buf;
int rand_n; int rand_n;
byte CMD_REFRESH;
//struct t_settings { //struct t_settings {
char sort_num=2; char sort_num=2;
@ -134,10 +132,7 @@ void main()
dword id; dword id;
byte count_sl = 0; byte count_sl = 0;
signed x_old, y_old, dif_x, dif_y, adif_x, adif_y; signed x_old, y_old, dif_x, dif_y, adif_x, adif_y;
char can_show, can_select, stats; char stats;
dword selected_offset;
dword IPC_LEN,IPC_ID;
char IPC_BUF[10];
rand_n = random(40); rand_n = random(40);
load_dll(boxlib, #box_lib_init,0); load_dll(boxlib, #box_lib_init,0);
@ -410,7 +405,7 @@ void main()
break; break;
case 049: //Ctrl+N - create new window case 049: //Ctrl+N - create new window
if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD); if (Form.left==98) MoveSize(Form.left-20,Form.top-20,OLD,OLD);
RunProgram("/sys/File Managers/Eolite", #path); RunProgram(I_Path, #path);
break; break;
case 050: //Ctrl+M case 050: //Ctrl+M
Open_Dir(#inactive_path,WITH_REDRAW); Open_Dir(#inactive_path,WITH_REDRAW);
@ -881,7 +876,7 @@ void Open(byte rez)
{ {
if (!strncmp(#file_name,"..",3)) return; if (!strncmp(#file_name,"..",3)) return;
strcpy(#temp, #file_path); strcpy(#temp, #file_path);
RunProgram("/sys/File Managers/Eolite", #temp); RunProgram(I_Path, #temp);
return; return;
} }
if (!files.count) return; if (!files.count) return;

View File

@ -278,7 +278,7 @@ enum
} }
else else
{ {
strcpy(#absolute_path, #program_path); strcpy(#absolute_path, I_Path);
absolute_path[strrchr(#absolute_path, '/')] = '\0'; absolute_path[strrchr(#absolute_path, '/')] = '\0';
strcat(#absolute_path, relative_path); strcat(#absolute_path, relative_path);
} }

View File

@ -70,9 +70,9 @@ GETKEYII:
$shr eax,8 $shr eax,8
} }
unsigned char key_ascii; :unsigned char key_ascii;
dword key_scancode, key_modifier, key_editbox; :dword key_scancode, key_modifier, key_editbox;
int GetKeys() :int GetKeys()
{ {
$push edx $push edx
GETKEY: GETKEY:

View File

@ -360,22 +360,24 @@ inline fastcall void DrawTitle( ECX)
$int 0x40; $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; EAX = 4;
EBX = x<<16+y; EBX = x<<16+y;
ECX = fontType<<24+color; ECX = fontType<<24+color;
EDX = str_offset;
ESI = 0; ESI = 0;
$int 0x40; $int 0x40;
$add ebx, 1<<16 $add ebx, 1<<16
$int 0x40 $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; EAX = 4;
EBX = x<<16+y; EBX = x<<16+y;
ECX = fontType<<24+color; ECX = fontType<<24+color;
EDX = str_offset;
$int 0x40; $int 0x40;
} }
@ -387,18 +389,20 @@ dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI)
$int 0x40; $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; EAX = 47;
EBX = count<<16; EBX = count<<16;
ECX = number_or_offset;
EDX = x<<16+y; EDX = x<<16+y;
ESI = fontType<<24+color; ESI = fontType<<24+color;
$int 0x40; $int 0x40;
} }
void CopyScreen(dword EBX, x, y, w, h) :void CopyScreen(dword dst_offset, x, y, w, h)
{ {
EAX = 36; EAX = 36;
EBX = dst_offset;
ECX = w << 16 + h; ECX = w << 16 + h;
EDX = x << 16 + y; EDX = x << 16 + y;
$int 0x40; $int 0x40;
@ -411,10 +415,10 @@ void CopyScreen(dword EBX, x, y, w, h)
$int 0x40 $int 0x40
} }
:void _PutImage(dword x,y, w,h, data_offset)
void _PutImage(dword x,y, w,h, EBX)
{ {
EAX = 7; EAX = 7;
EBX = data_offset;
ECX = w<<16+h; ECX = w<<16+h;
EDX = x<<16+y; EDX = x<<16+y;
$int 0x40 $int 0x40
@ -610,6 +614,8 @@ void ______INIT______()
mem_init(); mem_init();
if (program_path[0]!='/') I_Path++;
main(); main();
ExitProcess(); ExitProcess();
} }

View File

@ -66,7 +66,7 @@ void main()
} }
else else
{ {
strcat(#settings_ini_path, #program_path + strrchr(#program_path, '/')); strcat(#settings_ini_path, I_Path + strrchr(I_Path, '/'));
strcat(#settings_ini_path, ".ini"); strcat(#settings_ini_path, ".ini");
} }

View File

@ -59,7 +59,7 @@ void gui()
break; break;
case BID_COMPARE: case BID_COMPARE:
sprintf(#run_param, "\"%s\" \"%s\"", #src_box_text, #dst_box_text); 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;
} }
break; break;