//HTML Viewer in C-- //Copyright 2007-2012 by Veliant & Leency //Asper, lev, Lrz, Barsuk, Nable. //home icon - rachel fu, GPL licence #include "..\lib\kolibri.h" #include "..\lib\strings.h" #include "..\lib\figures.h" #include "..\lib\encoding.h" #include "..\lib\file_system.h" #include "..\lib\mem.h" #include "..\lib\dll.h" //библиотеки .obj #include "..\lib\libio_lib.h" #include "..\lib\libimg_lib.h" #include "..\lib\edit_box_lib.h" #include "..\lib\scroll_lib.h" #include "..\lib\truetype.h" //картинки #include "img\toolbar_icons.c" #include "img\URLgoto.txt"; #define URL param int use_truetype = 0; char editURL[sizeof(URL)], page_links[12000], header[300]; struct lines{ int visible, all, first, column_max; }; int mouse_dd; edit_box edit1= {250,207,16,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(editURL),#editURL,#mouse_dd,2,19,19}; scroll_bar scroll1 = { 18,200,398, 44,18,0,115,15,0,0xeeeeee,0xD2CED0,0x555555,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1}; //details in scroll_lib.h-- proc_info Form; #define WIN_W 640 #define WIN_H 480 dword stak[100]; //меню ПКМ mouse m; #include "TWB.h" #include "include\menu_rmb.h" void tre() { char *font_picture; char text[20]; int width=600; int height=20; // char palette[256*4]; int x; text_out stdcall ("hello world\0",#fontlol, 17, 0x0, 10, 10); text_out stdcall ("heyeyey!\0",#fontlol, 27, 0x0, 10, 30); text_out stdcall ("alarm!\0", #fontlol, 47, 0x00FF0000, 10, 70); /* strcpy(#text, "hello world\0"); debug("get width\n"); get_width stdcall (#text, #fontinfo, height); width=EAX; for (x=0;x<20;x++) { init_font(#fontinfo); debug("yaya\n"); font_picture=mem_Alloc(width*height); text[1]=30+x; truetype stdcall (#text, #fontinfo, font_picture, width, height); debug("blyad'!\n"); PutPaletteImage(font_picture,width,height,0,20*x,8,#palette); mem_Free(font_picture); }*/ } char fontlol[64]; void main() { int btn; byte key; int half_scroll_size; int scroll_used=0; mem_Init(); if (load_dll2(libio, #libio_init,1)!=0) debug("Не удалось подключить библиотеку libio"w); if (load_dll2(libimg, #libimg_init,1)!=0) debug("Не удалось подключить библиотеку libimg"w); if (load_dll2(boxlib, #edit_box_draw,0)!=0) {RunProgram("@notify", "System Error: library doesn't exists /rd/1/lib/box_lib.obj"); ExitProcess();} load_dll2(#abox_lib, #boxlib_init,0); if (load_dll2(libtruetype, #truetype,0)!=0) {debug("Не удалось подключить библиотеку TrueType"w); use_truetype = 2; } else init_font(#fontlol); if (!URL) strcpy(#URL, "/sys/home.htm"); strcpy(#editURL, #URL); Form.width=WIN_W; Form.height=WIN_H; SetElementSizes(); WB1.OpenPage(); SetEventMask(0x27); loop() { WaitEventTimeout(2); switch(EAX & 0xFF) { CASE evMouse: /*scrollbar_v_mouse (#scroll1); //конченый скролл притормажимает, идём "своим путём" if (lines.first <> scroll1.position) { lines.first = scroll1.position; WB1.ParseHTML(buf, filesize); //break; };*/ btn=GetProcessSlot(Form.ID); IF (btn<>GetActiveProcess()) break; //если окно не активно на события мыши не реагируем edit_box_mouse stdcall (#edit1); m.get(); if (m.pkm) && (m.y>WB1.top) && (m.y