/programs/cmm/aelia/parse_address.h |
---|
File deleted |
\ No newline at end of file |
/programs/cmm/aelia/aelia.c |
---|
1,4 → 1,4 |
#define MEMSIZE 4096*30 |
#define MEMSIZE 4096*60 |
#include "../lib/font.h" |
#include "../lib/io.h" |
13,10 → 13,8 |
#include "../lib/patterns/libimg_load_skin.h" |
#include "../lib/patterns/simple_open_dialog.h" |
#include "../lib/patterns/history.h" |
#include "../lib/patterns/http_downloader.h" |
#include "../browser/http_downloader.h" |
#include "parse_address.h" |
char default_dir[] = "/rd/1"; |
od_filter filter2 = {0,0}; |
48,9 → 46,9 |
MAGNIFY_PLUS, |
CHANGE_ENCODING, |
RUN_EDIT, |
SHOW_INFO, |
GO_BACK, |
GO_FORWARD, |
SANDWICH |
}; |
char address[UML]="http://"; |
60,8 → 58,12 |
#include "ini.h" |
#include "gui.h" |
#include "label.h" |
#include "link.h" |
#include "prepare_page.h" |
//#include "special_symbols.h" |
#define SANDWICH_MENU "Refresh page\nEdit page\nHistory\nAbout" |
void InitDlls() |
{ |
load_dll(boxlib, #box_lib_init, 0); |
98,15 → 100,22 |
break; |
case evReDraw: |
draw_window(); |
if (menu.list.cur_y) { |
if (menu.list.cur_y>=10) && (menu.list.cur_y<20) { |
encoding = menu.list.cur_y - 10; |
debugln("evReDraw: charset changed"); |
EventOpenAddress(history.current()); |
EventPageRefresh(); |
menu.list.cur_y = 0; |
} |
if (menu.list.cur_y>=20) { |
menu.list.cur_y-=20; |
if (menu.list.cur_y==0) EventPageRefresh(); |
if (menu.list.cur_y==1) EventRunEdit(); |
if (menu.list.cur_y==2) EventShowHistory(); |
if (menu.list.cur_y==3) EventShowInfo(); |
menu.list.cur_y = 0; |
} |
} |
} |
} |
void HandleButtonEvent() |
139,8 → 148,8 |
case RUN_EDIT: |
EventRunEdit(); |
break; |
case SHOW_INFO: |
EventShowInfo(); |
case SANDWICH: |
EventShowSandwichMenu(); |
break; |
} |
} |
205,6 → 214,7 |
edit_box_mouse stdcall (#address_box); |
mouse.get(); |
list.wheel_size = 7; |
link.hover(); |
if (list.MouseScroll(mouse.vert)) { |
DrawPage(); |
return; |
279,6 → 289,8 |
else |
DrawProgress(STEP_2_COUNT_PAGE_HEIGHT-STEP_1_DOWNLOAD_PAGE/2); |
} |
strcpy(#address,downloader.url); |
DrawAddressBox(); |
io.buffer_data = downloader.bufpointer; |
} |
} |
356,6 → 368,17 |
if (history.forward()) EventOpenAddress(history.current()); |
} |
void EventShowSandwichMenu() |
{ |
menu.selected = 0; |
menu.show(Form.left+Form.cwidth-130,Form.top+TOOLBAR_H+skin_height-10, 130, SANDWICH_MENU, 20); |
} |
void EventPageRefresh() |
{ |
EventOpenAddress(history.current()); |
} |
/* ------------------------------------------- */ |
375,11 → 398,10 |
DrawToolbarButton(GO_BACK, 8); |
DrawToolbarButton(GO_FORWARD, 33); |
DrawToolbarButton(OPEN_FILE, 68); |
DrawToolbarButton(MAGNIFY_PLUS, Form.cwidth - 161); |
DrawToolbarButton(MAGNIFY_MINUS, Form.cwidth - 136); |
DrawToolbarButton(CHANGE_ENCODING, Form.cwidth - 102); |
DrawToolbarButton(RUN_EDIT, Form.cwidth - 68); |
DrawToolbarButton(SHOW_INFO, Form.cwidth - 34); |
DrawToolbarButton(MAGNIFY_PLUS, Form.cwidth - 125); |
DrawToolbarButton(MAGNIFY_MINUS, Form.cwidth - 100); |
DrawToolbarButton(CHANGE_ENCODING, Form.cwidth - 64); |
DrawToolbarButton(SANDWICH, Form.cwidth - 31); |
DrawAddressBox(); |
413,7 → 435,7 |
{ |
address_box.left = 97; |
address_box.top = 11; |
address_box.width = Form.cwidth - address_box.left - 172; |
address_box.width = Form.cwidth - address_box.left - 138; |
DrawRectangle(address_box.left-4, address_box.top-5, address_box.width+6, 23, 0x8C8C8C); |
DrawWideRectangle(address_box.left-3, address_box.top-3, address_box.width+5, 21, 4, address_box.color); |
address_box.size = address_box.pos = address_box.shift = address_box.shift_old = strlen(#address); |
/programs/cmm/aelia/buidin_pages/about.htm |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
/programs/cmm/aelia/link.h |
---|
0,0 → 1,55 |
struct _link |
{ |
int count; |
int x[4096], y[4096], w[4096], h[4096]; |
collection text; |
collection url; |
void clear(); |
void add(); |
int hover(); |
int active; |
} link; |
void _link::clear() |
{ |
text.drop(); |
url.drop(); |
count = 0; |
} |
void _link::add(int _xx, _yy, _ww, _hh, dword _textt, _urll ) |
{ |
if (count==4095) return; |
x[count] = _xx; |
y[count] = _yy; |
w[count] = _ww; |
h[count] = _hh; |
text.add(_textt); |
url.add(_urll); |
count++; |
} |
int _link::hover() |
{ |
//char tempp[4096]; |
dword color; |
int i; |
active = 0; |
mouse.x = mouse.x - list.x; |
mouse.y = mouse.y - list.y; |
for (i=0; i<link.count; i++) { |
if(link.y[i]>list.first*list.item_h) && (link.y[i]<list.first*list.item_h+list.h) { |
// sprintf(#tempp, "mx:%i my:%i x[i]:%i y[i]:%i", mx, my, x[i], y[i]); |
// sprintf(#tempp); |
if (mouse.x>link.x[i]) |
&& (-list.first*list.item_h+link.y[i]<mouse.y) |
&& (mouse.x<link.x[i]+link.w[i]) |
&& (-list.first*list.item_h+link.y[i]+link.h[i]>mouse.y) |
color = 0xFF0000; |
else |
color = 0xCCCccc; |
DrawRectangle(link.x[i]+list.x+1, -list.first*list.item_h+link.y[i]+list.y, link.w[i], link.h[i], color); |
} |
} |
return false; |
} |
/programs/cmm/aelia/prepare_page.h |
---|
6,6 → 6,7 |
//get font chars width, need to increase performance |
get_label_symbols_size(); |
ChangeCharset(charsets[encoding], "CP866", io.buffer_data); |
link.clear(); |
if (strstri(io.buffer_data, "<html")==-1) { |
debugln("no <html> found"); |
DrawProgress(STEP_2_COUNT_PAGE_HEIGHT); ParceTxt(false); //get page height to calculate buffer size |
82,8 → 83,19 |
bool pre; |
bool ignore; |
dword color; |
void clear(); |
} style; |
void _style::clear() |
{ |
b=u=i=s=0; |
h1=h2=h3=h4=h5=h6=0; |
a=0; |
pre=0; |
ignore=0; |
color=0; |
} |
struct _text { |
dword start; |
int x, y; |
96,6 → 108,7 |
dword value[10]; |
void parce(); |
int nameis(); |
void clear(); |
}; |
void _tag::parce() |
108,10 → 121,15 |
int _tag::nameis(dword _in_tag_name) |
{ |
if (strcmp(_in_tag_name, name)==0) return true; |
if (name) && (strcmp(_in_tag_name, name)==0) return true; |
return false; |
} |
void _tag::clear() |
{ |
start=name=0; |
} |
#define HTML_PADDING_X 8; |
#define HTML_PADDING_Y 5; |
127,6 → 145,8 |
_tag tag; |
dword DOM_pos; |
tag.clear(); |
style.clear(); |
/* Create DOM */ |
debugln("creating DOM"); |
DOM.len = strlen(io.buffer_data); |
133,15 → 153,16 |
DOM.start = malloc(DOM.len); |
DOM.end = DOM.start + DOM.len; |
strlcpy(DOM.start, io.buffer_data, DOM.len); |
//RemoveSpecialSymbols(DOM.start, DOM.len); |
//DOM.len = strlen(DOM.start); |
/* Parce DOM */ |
debugln("starting DOM parce..."); |
text.start = DOM_pos; |
text.start = DOM.start; |
for (DOM_pos=DOM.start; DOM_pos<DOM.end; DOM_pos++) |
{ |
if (ESBYTE[DOM_pos]==0x0D) || (ESBYTE[DOM_pos]==0x0A) ESBYTE[DOM_pos]=' '; |
ch = ESBYTE[DOM_pos]; |
//debugch(ch); |
if (ch=='<') { |
ESBYTE[DOM_pos] = '\0'; |
tag.start = DOM_pos + 1; |
152,7 → 173,6 |
} |
while (get_label_len(text.start) + stroka_x + 30 > list.w) |
{ |
//debugln("long line cut"); |
zeroch = 0; |
for (line_break=tag.start-1; line_break>text.start; line_break--;) |
{ |
161,7 → 181,10 |
ESBYTE[line_break] >< zeroch; //restore line |
} |
if (draw==true) { |
if (style.a) label_draw_bar(stroka_x, stroka_y+label.size.pt+1, get_label_len(text.start), style.color); |
if (style.a) { |
link.add(stroka_x,stroka_y,get_label_len(text.start),list.item_h,text.start," "); |
label_draw_bar(stroka_x, stroka_y+label.size.pt+1, get_label_len(text.start), style.color); |
} |
WriteTextIntoBuf(stroka_x, stroka_y, style.color, text.start); |
} |
ESBYTE[line_break] >< zeroch; //restore line |
170,7 → 193,10 |
stroka_y += list.item_h; |
} |
if (draw==true) { |
if (style.a) label_draw_bar(stroka_x, stroka_y+label.size.pt+1, get_label_len(text.start), style.color); |
if (style.a) { |
link.add(stroka_x,stroka_y,get_label_len(text.start),list.item_h,text.start," "); |
label_draw_bar(stroka_x, stroka_y+label.size.pt+1, get_label_len(text.start), style.color); |
} |
WriteTextIntoBuf(stroka_x, stroka_y, style.color, text.start); |
} |
stroka_x += get_label_len(text.start); |
/programs/cmm/aelia/toolbar.png |
---|
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |