Rev 7995 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 7995 | Rev 8008 | ||
---|---|---|---|
1 | struct s_image |
1 | struct img |
2 | { |
2 | { |
3 | dword *image; |
3 | collection src; |
4 | char path[4096]; |
4 | collection_img data; |
- | 5 | collection_int xywh; |
|
- | 6 | drop(); |
|
5 | }; |
7 | }; |
6 | - | ||
7 | s_image pics[100]; //pics = mem_Alloc( 100*sizeof(s_image) ); |
- | |
8 | - | ||
9 | struct ImageCache { |
- | |
10 | int pics_count; |
- | |
11 | void Free(); |
- | |
12 | int GetImage(); |
- | |
13 | void Images(); |
- | |
14 | }; |
- | |
15 | 8 | ||
16 | void ImageCache::Free() |
- | |
17 | { |
- | |
18 | for ( ; pics_count>0; pics_count--) |
- | |
19 | { |
- | |
20 | if (pics[pics_count].image) img_destroy stdcall (pics[pics_count].image); |
- | |
21 | pics[pics_count].path = NULL; |
- | |
22 | } |
- | |
23 | } |
- | |
24 | - | ||
25 | int ImageCache::GetImage(dword i_path) |
9 | void img::drop() |
26 | { |
- | |
27 | int i; |
10 | { |
28 | return 0; |
- | |
29 | for (i=0; i<=pics_count; i++) if (!strcmp(#pics[i].path, i_path)) return i; //image exists |
- | |
30 | // Load image and add it to Cache |
11 | src.drop(); |
31 | pics_count++; |
- | |
32 | //pics[pics_count].image = load_EEERRRR_image(i_path); |
- | |
33 | //strcpy(#pics[pics_count].path, i_path); |
- | |
34 | return pics_count; |
12 | data.drop(); |
35 | } |
13 | } |
36 | 14 | ||
37 | 15 | ||
38 | void ImageCache::Images(dword left1, top1, width1) |
16 | void ImageCache::Images(dword left1, top1, width1) |
39 | { |
17 | { |
40 | dword image; |
18 | dword image; |
41 | dword imgw=0, imgh=0, img_lines_first=0, cur_pic=0; |
19 | dword imgw=0, imgh=0, img_lines_first=0, cur_pic=0; |
42 | 20 | ||
43 | //GetAbsoluteURL(#img_path); |
21 | //GetAbsoluteURL(#img_path); |
44 | //cur_pic = GetImage(#img_path); |
22 | //cur_pic = GetImage(#img_path); |
45 | 23 | ||
46 | if (!pics[cur_pic].image) |
24 | if (!pics[cur_pic].image) |
47 | { |
25 | { |
48 | //cur_pic = GetImage("/sys/network/noimg.png"); |
26 | //cur_pic = GetImage("/sys/network/noimg.png"); |
49 | return; |
27 | return; |
50 | } |
28 | } |
51 | 29 | ||
52 | imgw = DSWORD[pics[cur_pic].image+4]; |
30 | imgw = DSWORD[pics[cur_pic].image+4]; |
53 | imgh = DSWORD[pics[cur_pic].image+8]; |
31 | imgh = DSWORD[pics[cur_pic].image+8]; |
54 | if (imgw > width1) imgw = width1; |
32 | if (imgw > width1) imgw = width1; |
55 | 33 | ||
56 | /* |
34 | /* |
57 | draw_y += imgh + 5; TEMPORARY TURN OFF!!! |
35 | draw_y += imgh + 5; TEMPORARY TURN OFF!!! |
58 | 36 | ||
59 | if (top1+imgh |
37 | if (top1+imgh |
60 | if (top1 |
38 | if (top1 |
61 | { |
39 | { |
62 | img_lines_first=WB1.list.y-top1; |
40 | img_lines_first=WB1.list.y-top1; |
63 | imgh=imgh-img_lines_first; |
41 | imgh=imgh-img_lines_first; |
64 | top1=WB1.list.y; |
42 | top1=WB1.list.y; |
65 | } |
43 | } |
66 | if (top1>WB1.list.y+WB1.list.h-imgh-5) //if image partly visible (at the bottom) |
44 | if (top1>WB1.list.y+WB1.list.h-imgh-5) //if image partly visible (at the bottom) |
67 | { |
45 | { |
68 | imgh=WB1.list.y+WB1.list.h-top1-5; |
46 | imgh=WB1.list.y+WB1.list.h-top1-5; |
69 | } |
47 | } |
70 | if (imgh<=0) return; |
48 | if (imgh<=0) return; |
71 | 49 | ||
72 | img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first); |
50 | img_draw stdcall (pics[cur_pic].image, left1-5, top1, imgw, imgh,0,img_lines_first); |
73 | DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, page_bg); |
51 | DrawBar(left1+imgw - 5, top1, WB1.list.w-imgw, imgh, page_bg); |
74 | DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, page_bg); |
52 | DrawBar(WB1.list.x, top1+imgh, WB1.list.w, -imgh % WB1.list.item_h + WB1.list.item_h, page_bg); |
75 | if (link) |
53 | if (link) |
76 | { |
54 | { |
77 | UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, links.count + 400 + BT_HIDE, 0xB5BFC9); |
55 | UnsafeDefineButton(left1 - 5, top1, imgw, imgh-1, links.count + 400 + BT_HIDE, 0xB5BFC9); |
78 | links.AddText(0, imgw, imgh-1, NOLINE, 1); |
56 | links.AddText(0, imgw, imgh-1, NOLINE, 1); |
79 | WB1.DrawPage(); |
57 | WB1.DrawPage(); |
80 | } |
58 | } |
81 | */ |
59 | */ |
82 | } |
60 | } |
83 | 61 | ||
84 | ImageCache ImgCache;=0)>=pics_count;> |
62 | ImageCache ImgCache;=0)> |