2013-12-27 03:36:17 +04:00
|
|
|
|
struct s_image
|
|
|
|
|
{
|
|
|
|
|
dword *image;
|
|
|
|
|
char path[4096];
|
|
|
|
|
};
|
2014-01-19 21:12:45 +04:00
|
|
|
|
|
2013-12-27 03:36:17 +04:00
|
|
|
|
s_image pics[100]; //pics = mem_Alloc( 100*sizeof(s_image) );
|
|
|
|
|
|
2014-01-20 02:46:58 +04:00
|
|
|
|
struct ImageCache {
|
2014-01-19 21:12:45 +04:00
|
|
|
|
int pics_count;
|
|
|
|
|
void Free();
|
2014-01-29 04:14:09 +04:00
|
|
|
|
int GetImageNumber();
|
2014-01-19 21:12:45 +04:00
|
|
|
|
void Images();
|
2014-01-20 02:46:58 +04:00
|
|
|
|
};
|
2014-01-19 21:12:45 +04:00
|
|
|
|
|
2014-01-20 02:46:58 +04:00
|
|
|
|
void ImageCache::Free()
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-19 21:12:45 +04:00
|
|
|
|
for ( ; pics_count>0; pics_count--)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-19 21:12:45 +04:00
|
|
|
|
if (pics[pics_count].image) img_destroy stdcall (pics[pics_count].image);
|
|
|
|
|
pics[pics_count].path = NULL;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2014-01-29 04:14:09 +04:00
|
|
|
|
int ImageCache::GetImageNumber(dword i_path)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2014-01-19 21:12:45 +04:00
|
|
|
|
int i;
|
|
|
|
|
for (i=0; i<pics_count; i++) if (!strcmp(#pics[i].path, i_path)) return i; //image exists
|
|
|
|
|
// Load image and add it to Cache
|
|
|
|
|
pics_count++;
|
|
|
|
|
pics[pics_count].image = load_image(i_path);
|
|
|
|
|
strcpy(#pics[pics_count].path, i_path);
|
|
|
|
|
return pics_count;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2014-01-20 02:46:58 +04:00
|
|
|
|
void ImageCache::Images(int left1, top1, width1)
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
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=")) //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> GetNewUrl()
|
|
|
|
|
{
|
2014-01-28 00:16:33 +04:00
|
|
|
|
//if (downloader_id) strcpy(#img_path, #history_list[history_current-1].Item); else
|
|
|
|
|
strcpy(#img_path, BrowserHistory.CurrentUrl());
|
2013-12-27 03:36:17 +04:00
|
|
|
|
if (strcmpn(#img_path, "http:", 5)!=0) || (strcmpn(#options, "http:", 5)!=0)
|
|
|
|
|
{
|
2013-12-27 05:08:50 +04:00
|
|
|
|
//get path: absolute or relative
|
|
|
|
|
if (options[0]=='/')
|
|
|
|
|
strcpy(#img_path, #options);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
img_path[strrchr(#img_path, '/')] = '\0';
|
|
|
|
|
strcat(#img_path, #options);
|
2013-12-27 16:30:42 +04:00
|
|
|
|
}
|
2014-01-29 04:14:09 +04:00
|
|
|
|
cur_pic = GetImageNumber(#img_path);
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
}
|
2013-12-27 05:08:50 +04:00
|
|
|
|
if (!strcmp(#parametr,"alt="))
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
|
|
|
|
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;
|
|
|
|
|
|
2013-12-27 05:08:50 +04:00
|
|
|
|
if (stroka==0) DrawBar(WB1.list.x, WB1.list.y, WB1.list.w-15, 5, bg_color); //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-01-19 21:12:45 +04:00
|
|
|
|
stroka += h/10;
|
2013-12-27 05:08:50 +04:00
|
|
|
|
if (top1+h<WB1.list.y) || (top1>WB1.list.y+WB1.list.h-10) return; //<2F><><EFBFBD><EFBFBD> <20>Ѩ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD> <20><><EFBFBD><EFBFBD>
|
|
|
|
|
if (top1<WB1.list.y) //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2013-12-27 05:08:50 +04:00
|
|
|
|
img_lines_first=WB1.list.y-top1;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
h=h-img_lines_first;
|
2013-12-27 05:08:50 +04:00
|
|
|
|
top1=WB1.list.y;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
2013-12-27 05:08:50 +04:00
|
|
|
|
if (top1>WB1.list.y+WB1.list.h-h-5) //<2F><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>
|
2013-12-27 03:36:17 +04:00
|
|
|
|
{
|
2013-12-27 05:08:50 +04:00
|
|
|
|
h=WB1.list.y+WB1.list.h-top1-5;
|
2013-12-27 03:36:17 +04:00
|
|
|
|
}
|
|
|
|
|
if (h<=0) return;
|
|
|
|
|
if (anchor) return;
|
|
|
|
|
|
|
|
|
|
img_draw stdcall (pics[cur_pic].image, left1-5, top1, w, h,0,img_lines_first);
|
2013-12-27 05:08:50 +04:00
|
|
|
|
DrawBar(left1+w - 5, top1, WB1.list.w-w, h, bg_color);
|
2014-01-20 03:48:36 +04:00
|
|
|
|
IF (link) UnsafeDefineButton(left1 - 5, top1, w, h-1, PageLinks.count + 400 + BT_HIDE, 0xB5BFC9);
|
2014-01-20 02:46:58 +04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ImageCache ImgCache;
|