diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 2a36c57abf..431779d797 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -128,21 +128,12 @@ void main() if (bufsize) && (mouse.pkm) && (mouse.up) { CreateThread(#menu_rmb,#stak+4092); break; } if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage(); } - //Drag scroller - scroll_wv.all_redraw = 0; - if (!mouse.lkm) scroll_used=0; - if (mouse.x>=scroll_wv.start_x) && (mouse.x<=scroll_wv.start_x+scroll_wv.size_x) - && (mouse.y>=scroll_wv.start_y+scroll_wv.btn_height) && (-scroll_wv.btn_height+scroll_wv.start_y+scroll_wv.size_y>mouse.y) - && (WB1.list.count>WB1.list.visible) && (mouse.lkm) scroll_used=1; - if (scroll_used) + scrollbar_v_mouse (#scroll_wv); + if (WB1.list.first != scroll_wv.position) { - mouse.y = mouse.y + 5; - half_scroll_size = WB1.list.h - 16 * WB1.list.visible / WB1.list.count - 3 /2; - if (half_scroll_size+WB1.list.y>mouse.y) || (mouse.y<0) || (mouse.y>4000) mouse.y=half_scroll_size+WB1.list.y; - btn=WB1.list.first; - WB1.list.first = mouse.y -half_scroll_size -WB1.list.y * WB1.list.count / WB1.list.h; - if (WB1.list.visible+WB1.list.first>WB1.list.count) WB1.list.first=WB1.list.count-WB1.list.visible; - if (btn!=WB1.list.first) WB1.DrawPage(); + WB1.list.first = scroll_wv.position; + WB1.DrawPage(); + break; } break; diff --git a/programs/cmm/lib/font.h b/programs/cmm/lib/font.h index 70cef05cbf..5d7102c5ad 100644 --- a/programs/cmm/lib/font.h +++ b/programs/cmm/lib/font.h @@ -9,10 +9,6 @@ #include "../lib/io.h" #endif - -#define CP866 0 -#define ANSI 1 - :struct __SIZE { word width,height; @@ -38,43 +34,34 @@ byte symbol(word x;byte s;dword c); byte symbol_size(byte s); dword prepare(word x,y;dword text1); + void prepare_buf(word x,y,w,h;dword text1); void show(word x,y); byte textcenter(word x,y,w,h;dword txt); dword getsize(dword text1); dword textarea(word x,y;dword text,c); byte changeSIZE(); void PixelRGB(word x,y); - dword GetPixel(word x,y); - dword tmp_y,tmp_height,tmp_x; + //dword GetPixel(word x,y); byte no_bg_copy; dword bg_color; }; FONT font = 0; - +/* :dword FONT::GetPixel(word x,y) { - dword tmp; - tmp = y*size.width*3; - tmp += x*3; - tmp += buffer; + dword tmp = y*size.width*3; + tmp += x*3 + buffer; r = DSBYTE[tmp]; - tmp++; - g = DSBYTE[tmp]; - tmp++; - b = DSBYTE[tmp]; -} + g = DSBYTE[tmp+1]; + b = DSBYTE[tmp+2]; +}*/ :void FONT::PixelRGB(dword x,y) { - dword tmp; - tmp = y*size.width*3; - tmp += x*3; - tmp += buffer; - + dword tmp = y*size.width*3; + tmp += x*3 + buffer; DSBYTE[tmp] = r; - tmp++; - DSBYTE[tmp] = g; - tmp++; - DSBYTE[tmp] = b; + DSBYTE[tmp+1] = g; + DSBYTE[tmp+2] = b; } :byte FONT::changeSIZE() { @@ -163,8 +150,7 @@ FONT font = 0; } yi = 0; iii = 0; - tmp = 4*block*s; - tmp +=data; + tmp = 4*block*s + data; while(yi>= 1; - ELSE - { - tmp += 4; - _ = DSDWORD[tmp]; - } - if(_&1) - { - IF(xi>rw)rw=xi; - ___x = x+xi; - IF(italic)___x+=math.ceil(ital); - if(___x>= 1; + ELSE + { + tmp += 4; + _ = DSDWORD[tmp]; + } + if(_&1) + { + IF(xi>rw)rw=xi; + ___x = x+xi; + IF(italic)___x+=math.ceil(ital); + PixelRGB(___x,TMP); + _TMP_WEIGHT = size.TMP_WEIGHT; + WHILE(_TMP_WEIGHT) + { + IF(weight) PixelRGB(___x+_TMP_WEIGHT,TMP); + _TMP_WEIGHT--; + } + } + xi++; + iii++; + } + yi++; + IF(italic) ital-=size.offset_i; } return rw; } :byte FONT::load(dword path) { - dword tmp; buffer_size = 0; IF(data)free(data); - if (!io.readKPACK(path)) - { - debug("Error while loading font: "); - debugln(path); - return false; - } - begin = tmp = data = io.buffer_data; + if (!io.readKPACK(path)) { debug("Error while loading font: "); debugln(path); return false; } + begin = data = io.buffer_data; size_file = io.FILES_SIZE; - tmp +=size_file; - tmp--; - height = DSBYTE[tmp]; - tmp--; - width = DSBYTE[tmp]; + EBX = begin + size_file; + height = DSBYTE[EBX - 1]; + width = DSBYTE[EBX - 2]; block = math.ceil(height*width/32); return true; } +:void FONT::prepare_buf(word x,y,w,h; dword text1) +{ + signed len=0; + dword c; + c = color; + IF(!text1)return; + IF(size.text)IF(!changeSIZE())return; + GetProcessInfo(#Form_SELF_FONTS, SelfInfo); + AX = c; r = AL; g = AH; c>>=16; AX = c; b = AL; + getsize(text1); + y -= size.offset_y; + + size.width = w; + size.height = y; + EDX = size.width*size.height*3; + IF(!buffer_size) + { + buffer_size = EDX; + buffer = malloc(buffer_size); + EBX = bg_color; + EDI = buffer; + EAX = buffer_size+EDI; + WHILE (EDI