Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 3465 → Rev 3466

/programs/cmm/browser/include/img_cache.h
0,0 → 1,95
struct s_image
{
dword *image;
char path[4096];
};
s_image pics[100]; //pics = mem_Alloc( 100*sizeof(s_image) );
int num_of_pics;
 
int GetOrSetPicNum(dword i_path)
{
int i;
for (i=0; i<num_of_pics; i++)
{
if (!strcmp(#pics[i].path, i_path)) return i;
}
num_of_pics++;
return num_of_pics;
}
 
void FreeImgCache()
{
int i;
for (i=0; i<=num_of_pics; i++)
{
img_destroy stdcall (pics[num_of_pics].image);
pics[num_of_pics].path = NULL;
}
num_of_pics=0;
}
 
 
void Images(int left1, top1, width1)
{
dword image;
char img_path[4096], alt[4096];
int w=0, h=0, img_lines_first=0, cur_pic=0;
do{
if (!strcmp(#parametr,"src=")) //íàäî îáúåäèíèòü ñ GetNewUrl()
{
if (downloader_id) strcpy(#img_path, #history_list[history_current-1].Item);
else strcpy(#img_path, BrowserHistory.CurrentUrl()); //äîñòà¸ì àäðåñ òåêóùåé ñòðàíèöû
if (strcmpn(#img_path, "http:", 5)!=0) || (strcmpn(#options, "http:", 5)!=0)
{
img_path[strrchr(#img_path, '/')] = '\0'; //îáðåçàåì å¸ óðë äî ïîñëåäíåãî /
strcat(#img_path, #options);
cur_pic=GetOrSetPicNum(#img_path);
if (!pics[cur_pic].path)
{
pics[cur_pic].image=load_image(#img_path);
strcpy(#pics[cur_pic].path, #img_path);
}
}
}
if (!strcmp(#parametr,"alt="))
{
strcpy(#alt, "[");
strcat(#alt, #options);
strcat(#alt, "]");
}
 
} while(GetNextParam());
if (!pics[cur_pic].image)
{
if (alt) && (link) strcat(#line, #alt);
return;
}
w = DSWORD[pics[cur_pic].image+4];
h = DSWORD[pics[cur_pic].image+8];
if (w > width1) w = width1;
if (stroka==0) DrawBar(WB1.left, WB1.top, WB1.width-15, 5, bg_color); //çàêðàøèâàåì ïåðâóþ ñòðîêó
stroka+=h/10;
if (top1+h<WB1.top) || (top1>WB1.top+WB1.height-10) return; //åñëè ÂѨ èçîáðàæåíèå óøëî ÂÅÐÕ èëè ÂÍÈÇ
if (top1<WB1.top) //åñëè ÷àñòü èçîáðàæåíèÿ ñâåðõó
{
img_lines_first=WB1.top-top1;
h=h-img_lines_first;
top1=WB1.top;
}
if (top1>WB1.top+WB1.height-h-5) //åñëè ÷àñòü èçîáðàæåíèÿ ñíèçó
{
h=WB1.top+WB1.height-top1-5;
}
if (h<=0) return;
if (anchor) return;
img_draw stdcall (pics[cur_pic].image, left1-5, top1, w, h,0,img_lines_first);
DrawBar(left1+w - 5, top1, WB1.width-w, h, bg_color);
IF (link) UnsafeDefineButton(left1 - 5, top1, w, h-1, blink + BT_HIDE, 0xB5BFC9);
}
/programs/cmm/browser/include/menu_rmb.h
4,6 → 4,7
#define ITEM_WIDTH 138
 
char *ITEMS_LIST[]={
//"Old HTMLv F12",255,
"View in Tinypad F3",52,
"WIN F5",54,
"DOS Ctrl+D",04,
/programs/cmm/browser/include/some_code.h
31,28 → 31,4
}
page_links[j] = 0x00;
strcpy(#URL, #page_links+strrchr(#page_links, '|'));
}
 
 
//Ó íàñ íåò íàêëîííûõ øðèôòîâ, ïîýòîìó äåëàåì êîñòûëü èç
//ïàëî÷åê äëÿ ìîðîæåíîãî è æåâàòåëüíîé ðåçèíêè:
//Ñíèìàåì îáëàñòü ýêðàíà è âûâîäèì å¸ îáðàòíî ïîëîñêàìè ñî ñìåùåíèåì,
//÷òî äà¸ò ïåðåêîñ êàðòèíêè
//Ïðè íàëè÷èè ôîíà è ò.ï. ïðîÿâèòñÿ âñÿ êîñòûëüíîñòü ðåøåíèÿ :)
 
inline void Skew(dword x,y,w,h)
{
dword italic_buf;
int tile_height=2,
shift=-2,
i, skin_height;
 
italic_buf = mem_Alloc(w*h*3);
skin_height = GetSkinHeight();
CopyScreen(italic_buf, x+Form.left+2, y+Form.top+skin_height, w, h);
 
FOR (i=0;i*tile_height<h;i++)
_PutImage(x+shift-i+1,i*tile_height+y, w,tile_height, w*3*tile_height*i+italic_buf);
mem_Free(italic_buf);
}
}