forked from KolibriOS/kolibrios
WebView: add clear cache feature
git-svn-id: svn://kolibrios.org@7770 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
0a6d41ab86
commit
3f59e384f1
@ -106,7 +106,7 @@ bool LinksArray::HoverAndProceed(dword mx, my, list_y, list_first)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (mouse.pkm) && (mouse.up) {
|
if (mouse.pkm) && (mouse.up) {
|
||||||
EventShowLinkMenu(mouse.x, mouse.y);
|
EventShowLinkMenu();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (active==i) return false;
|
if (active==i) return false;
|
||||||
|
@ -72,6 +72,7 @@ enum {
|
|||||||
NEW_WINDOW,
|
NEW_WINDOW,
|
||||||
VIEW_HISTORY,
|
VIEW_HISTORY,
|
||||||
DOWNLOAD_MANAGER,
|
DOWNLOAD_MANAGER,
|
||||||
|
CLEAR_CACHE,
|
||||||
UPDATE_BROWSER,
|
UPDATE_BROWSER,
|
||||||
COPY_LINK_URL,
|
COPY_LINK_URL,
|
||||||
DOWNLOAD_LINK_CONTENTS,
|
DOWNLOAD_LINK_CONTENTS,
|
||||||
@ -140,7 +141,7 @@ void main()
|
|||||||
mouse.get();
|
mouse.get();
|
||||||
if (PageLinks.HoverAndProceed(mouse.x, WB1.list.first + mouse.y, WB1.list.y, WB1.list.first))
|
if (PageLinks.HoverAndProceed(mouse.x, WB1.list.first + mouse.y, WB1.list.y, WB1.list.first))
|
||||||
&& (mouse.pkm) && (mouse.up) {
|
&& (mouse.pkm) && (mouse.up) {
|
||||||
if (WB1.list.MouseOver(mouse.x, mouse.y)) EventShowPageMenu(mouse.x, mouse.y);
|
if (WB1.list.MouseOver(mouse.x, mouse.y)) EventShowPageMenu();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
|
if (WB1.list.MouseScroll(mouse.vert)) WB1.DrawPage();
|
||||||
@ -202,10 +203,6 @@ void main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
if (menu.cur_y) {
|
|
||||||
ProcessEvent(menu.cur_y);
|
|
||||||
menu.cur_y = 0;
|
|
||||||
}
|
|
||||||
DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),
|
DefineAndDrawWindow(GetScreenWidth()-800/2-random(80),
|
||||||
GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0);
|
GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0);
|
||||||
GetProcessInfo(#Form, SelfInfo);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
@ -259,6 +256,11 @@ void SetElementSizes()
|
|||||||
void draw_window()
|
void draw_window()
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
if (menu.cur_y) {
|
||||||
|
EAX = menu.cur_y;
|
||||||
|
menu.cur_y = 0;
|
||||||
|
ProcessEvent(EAX);
|
||||||
|
}
|
||||||
SetElementSizes();
|
SetElementSizes();
|
||||||
|
|
||||||
DrawBar(0,0, Form.cwidth,PADDING, system.color.work);
|
DrawBar(0,0, Form.cwidth,PADDING, system.color.work);
|
||||||
@ -341,10 +343,10 @@ void ProcessEvent(dword id__)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case CHANGE_ENCODING:
|
case CHANGE_ENCODING:
|
||||||
EventShowEncodingsList(Form.cwidth - 150, status_text.start_y-117);
|
EventShowEncodingsList();
|
||||||
return;
|
return;
|
||||||
case SANDWICH_BUTTON:
|
case SANDWICH_BUTTON:
|
||||||
EventShowMainMenu(Form.cwidth - 215, TOOLBAR_H-6);
|
EventShowMainMenu();
|
||||||
return;
|
return;
|
||||||
case VIEW_SOURCE:
|
case VIEW_SOURCE:
|
||||||
EventViewSource();
|
EventViewSource();
|
||||||
@ -369,6 +371,10 @@ void ProcessEvent(dword id__)
|
|||||||
case UPDATE_BROWSER:
|
case UPDATE_BROWSER:
|
||||||
EventUpdateBrowser();
|
EventUpdateBrowser();
|
||||||
return;
|
return;
|
||||||
|
case CLEAR_CACHE:
|
||||||
|
pages_cache.clear();
|
||||||
|
notify(#clear_cache_ok);
|
||||||
|
return;
|
||||||
case COPY_LINK_URL:
|
case COPY_LINK_URL:
|
||||||
Clipboard__CopyText(PageLinks.GetURL(PageLinks.active));
|
Clipboard__CopyText(PageLinks.GetURL(PageLinks.active));
|
||||||
notify("'URL copied to clipboard'O");
|
notify("'URL copied to clipboard'O");
|
||||||
@ -628,29 +634,29 @@ void DrawProgress()
|
|||||||
DrawBar(address_box.left-1, address_box.top+20, persent*address_box.width+16/100, 2, 0x72B7EB);
|
DrawBar(address_box.left-1, address_box.top+20, persent*address_box.width+16/100, 2, 0x72B7EB);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventShowPageMenu(dword _left, _top)
|
void EventShowPageMenu()
|
||||||
{
|
{
|
||||||
menu.selected = 0;
|
menu.selected = 0;
|
||||||
menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #rmb_menu, VIEW_SOURCE);
|
menu.show(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, 220, #rmb_menu, VIEW_SOURCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventShowEncodingsList(dword _left, _top)
|
void EventShowLinkMenu()
|
||||||
|
{
|
||||||
|
menu.selected = 0;
|
||||||
|
menu.show(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, 220, #link_menu, COPY_LINK_URL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EventShowEncodingsList()
|
||||||
{
|
{
|
||||||
menu.selected = WB1.cur_encoding + 1;
|
menu.selected = WB1.cur_encoding + 1;
|
||||||
menu.show(Form.left+_left-6+77,Form.top+_top+skin_height-3, 100,
|
menu.show(Form.left + Form.cwidth - 95, Form.top + skin_height + status_text.start_y - 121, 90,
|
||||||
"UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866", ENCODINGS);
|
"UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866", ENCODINGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventShowMainMenu(dword _left, _top)
|
void EventShowMainMenu()
|
||||||
{
|
{
|
||||||
menu.selected = 0;
|
menu.selected = 0;
|
||||||
menu.show(Form.left+_left-6+77,Form.top+_top+skin_height-3, 140, #main_menu, OPEN_FILE);
|
menu.show(Form.left + Form.cwidth - 150, Form.top + skin_height + TOOLBAR_H-8, 140, #main_menu, OPEN_FILE);
|
||||||
}
|
|
||||||
|
|
||||||
void EventShowLinkMenu(dword _left, _top)
|
|
||||||
{
|
|
||||||
menu.selected = 0;
|
|
||||||
menu.show(Form.left+_left-6,Form.top+_top+skin_height+3, 220, #link_menu, COPY_LINK_URL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventUpdateProgressBar()
|
void EventUpdateProgressBar()
|
||||||
|
@ -8,6 +8,7 @@ struct PAGES_CACHE
|
|||||||
collection size; //it has to be int
|
collection size; //it has to be int
|
||||||
void add();
|
void add();
|
||||||
bool has();
|
bool has();
|
||||||
|
void clear();
|
||||||
} pages_cache;
|
} pages_cache;
|
||||||
|
|
||||||
void PAGES_CACHE::add(dword _url, _data, _size)
|
void PAGES_CACHE::add(dword _url, _data, _size)
|
||||||
@ -32,3 +33,12 @@ bool PAGES_CACHE::has(dword _link)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PAGES_CACHE::clear()
|
||||||
|
{
|
||||||
|
url.drop();
|
||||||
|
data.drop();
|
||||||
|
size.drop();
|
||||||
|
current_page_buf = NULL;
|
||||||
|
current_page_size = NULL;
|
||||||
|
}
|
@ -12,6 +12,7 @@
|
|||||||
<font color="#555555">• You can check for browser updates from the main menu.
|
<font color="#555555">• You can check for browser updates from the main menu.
|
||||||
• To run a web search, type a text in the adress box and press Ctrl+Enter.
|
• To run a web search, type a text in the adress box and press Ctrl+Enter.
|
||||||
• You can also use other <a href="WebView:help"><font color="#555555">Hotkeys</font></a>.
|
• You can also use other <a href="WebView:help"><font color="#555555">Hotkeys</font></a>.
|
||||||
|
• Click on a label in the bottom right corner to change the encoding of a page.
|
||||||
</font>
|
</font>
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
<font color="#555555">• ˆ§ £« ¢®£® ¬¥î ¬®¦® ¯à®¢¥à¨âì «¨ç¨¥ ®¡®¢«¥¨©
|
<font color="#555555">• ˆ§ £« ¢®£® ¬¥î ¬®¦® ¯à®¢¥à¨âì «¨ç¨¥ ®¡®¢«¥¨©
|
||||||
• „«ï ¯®¨áª ¢ Google ¡¥à¨â¥ â¥áâ ¢ ¤à¥á®© áâப¥ ¨ ¦¬¨â¥ Ctrl+Enter
|
• „«ï ¯®¨áª ¢ Google ¡¥à¨â¥ â¥áâ ¢ ¤à¥á®© áâப¥ ¨ ¦¬¨â¥ Ctrl+Enter
|
||||||
• …áâì â ª¦¥ ¤à㣨¥ <a href="WebView:help"><font color="#555555">ƒ®àï稥 ª« ¢¨è¨</font></a>.
|
• …áâì â ª¦¥ ¤à㣨¥ <a href="WebView:help"><font color="#555555">ƒ®àï稥 ª« ¢¨è¨</font></a>.
|
||||||
|
• <20>®¦® ¨§¬¥¨גל ×®₪¨א®¢×ד בגא ¨זכ, ₪«ן םג®£® ¦¬¨ג¥ ₪¯¨בל ¢ ¯א ¢®¬ ¨¦¥¬ ד£«ד ®× .
|
||||||
</font>
|
</font>
|
||||||
|
|
||||||
</pre>
|
</pre>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
char version[]="WebView 2.25";
|
char version[]="WebView 2.26";
|
||||||
|
|
||||||
#ifdef LANG_RUS
|
#ifdef LANG_RUS
|
||||||
char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0";
|
char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0";
|
||||||
@ -13,6 +13,7 @@ char main_menu[] =
|
|||||||
<EFBFBD>®¢®¥ ®ª®
|
<EFBFBD>®¢®¥ ®ª®
|
||||||
ˆáâ®à¨ï
|
ˆáâ®à¨ï
|
||||||
Œ¥¥¤¦¥à § £à㧮ª
|
Œ¥¥¤¦¥à § £à㧮ª
|
||||||
|
Žç¨áâ¨âì ªíè
|
||||||
Ž¡®¢¨âì ¡à 㧥à";
|
Ž¡®¢¨âì ¡à 㧥à";
|
||||||
char link_menu[] =
|
char link_menu[] =
|
||||||
"Š®¯¨à®¢ âì áá뫪ã
|
"Š®¯¨à®¢ âì áá뫪ã
|
||||||
@ -22,8 +23,9 @@ char loading_text[] = "
|
|||||||
char update_param[] = "-download_and_exit http://builds.kolibrios.org/rus/data/programs/cmm/browser/WebView.com";
|
char update_param[] = "-download_and_exit http://builds.kolibrios.org/rus/data/programs/cmm/browser/WebView.com";
|
||||||
char update_download_error[] = "'WebView\nŽè¨¡ª ¯à¨ ¯®«ã票¨ ®¡®¢«¥¨©!' -tE";
|
char update_download_error[] = "'WebView\nŽè¨¡ª ¯à¨ ¯®«ã票¨ ®¡®¢«¥¨©!' -tE";
|
||||||
char update_ok[] = "'WebView\n<EFBFBD>à ã§¥à ¡ë« ãá¯¥è® ®¡®¢«¥!' -tO";
|
char update_ok[] = "'WebView\n<EFBFBD>à ã§¥à ¡ë« ãá¯¥è® ®¡®¢«¥!' -tO";
|
||||||
char update_is_current[] = "'WebView\n‚ë 㦥 ¨á¯®«ì§ã¥â¥ ¯®á«¥¤îî ¢¥àá¨î.' -I";
|
char update_is_current[] = "'WebView\n‚ë 㦥 ¨á¯®«ì§ã¥â¥ ¯®á«¥¤îî ¢¥àá¨î.' -tI";
|
||||||
char update_can_not_copy[] = "'WebView\n<EFBFBD>¥ ¬®£ã ¯¥à¥¬¥áâ¨âì ®¢ãî ¢¥àá¨î ¨§ ¯ ¯ª¨ Downloads Ramdisk. ‚®§¬®¦®, ¥ ¤®áâ â®ç® ¬¥áâ .' -E";
|
char update_can_not_copy[] = "'WebView\n<EFBFBD>¥ ¬®£ã ¯¥à¥¬¥áâ¨âì ®¢ãî ¢¥àá¨î ¨§ ¯ ¯ª¨ Downloads Ramdisk. ‚®§¬®¦®, ¥ ¤®áâ â®ç® ¬¥áâ .' -tE";
|
||||||
|
char clear_cache_ok[] = "'WebView\nŠíè ®ç¨é¥.' -tI";
|
||||||
#else
|
#else
|
||||||
char page_not_found[] = FROM "html\\page_not_found_en.htm""\0";
|
char page_not_found[] = FROM "html\\page_not_found_en.htm""\0";
|
||||||
char homepage[] = FROM "html\\homepage_en.htm""\0";
|
char homepage[] = FROM "html\\homepage_en.htm""\0";
|
||||||
@ -37,6 +39,7 @@ char main_menu[] =
|
|||||||
New window
|
New window
|
||||||
History
|
History
|
||||||
Download Manager
|
Download Manager
|
||||||
|
Clear cache
|
||||||
Update browser";
|
Update browser";
|
||||||
char link_menu[] =
|
char link_menu[] =
|
||||||
"Copy link
|
"Copy link
|
||||||
@ -45,8 +48,9 @@ char loading_text[] = "Loading...";
|
|||||||
char update_param[] = "-download_and_exit http://builds.kolibrios.org/eng/data/programs/cmm/browser/WebView.com";
|
char update_param[] = "-download_and_exit http://builds.kolibrios.org/eng/data/programs/cmm/browser/WebView.com";
|
||||||
char update_download_error[] = "'WebView\nError receiving an up to date information!' -tE";
|
char update_download_error[] = "'WebView\nError receiving an up to date information!' -tE";
|
||||||
char update_ok[] = "'WebView\nThe browser has been updated!' -tO";
|
char update_ok[] = "'WebView\nThe browser has been updated!' -tO";
|
||||||
char update_is_current[] = "'WebView\nThe browser is up to date.' -I";
|
char update_is_current[] = "'WebView\nThe browser is up to date.' -tI";
|
||||||
char update_can_not_copy[] = "'WebView\nError copying a new version from Downloads folder!\nProbably too litle space on Ramdisk.' -E";
|
char update_can_not_copy[] = "'WebView\nError copying a new version from Downloads folder!\nProbably too litle space on Ramdisk.' -tE";
|
||||||
|
char clear_cache_ok[] = "'WebView\nThe cache has been cleared.' -tI";
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define URL_SERVICE_HISTORY "WebView:history"
|
#define URL_SERVICE_HISTORY "WebView:history"
|
||||||
|
@ -32,27 +32,26 @@
|
|||||||
|
|
||||||
:void _menu_thread()
|
:void _menu_thread()
|
||||||
{
|
{
|
||||||
proc_info MenuForm;
|
MOUSE m;
|
||||||
SetEventMask(100111b);
|
DefineAndDrawWindow(menu.appear_x,menu.appear_y,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
|
||||||
|
DrawPopup(0,0,menu.w,menu.h+3,0, 0xE4DFE1,0x9098B0);
|
||||||
|
_menu_draw_list();
|
||||||
|
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_MOUSE + EVM_MOUSE_FILTER);
|
||||||
loop() switch(WaitEvent())
|
loop() switch(WaitEvent())
|
||||||
{
|
{
|
||||||
case evMouse:
|
case evMouse:
|
||||||
GetProcessInfo(#MenuForm, SelfInfo);
|
m.get();
|
||||||
if (!CheckActiveProcess(MenuForm.ID)) _menu_no_item_click();
|
if (menu.ProcessMouse(m.x, m.y)) _menu_draw_list();
|
||||||
mouse.get();
|
if (m.lkm)&&(m.up) _menu_item_click();
|
||||||
if (menu.ProcessMouse(mouse.x, mouse.y)) _menu_draw_list();
|
|
||||||
if (mouse.lkm)&&(mouse.up) _menu_item_click();
|
|
||||||
break;
|
break;
|
||||||
case evKey:
|
case evKey:
|
||||||
GetKeys();
|
GetKeys();
|
||||||
if (key_scancode==SCAN_CODE_ESC) _menu_no_item_click();
|
if (key_scancode==SCAN_CODE_ESC) _menu_exit();
|
||||||
if (key_scancode==SCAN_CODE_ENTER) _menu_item_click();
|
if (key_scancode==SCAN_CODE_ENTER) _menu_item_click();
|
||||||
if (menu.ProcessKey(key_scancode)) _menu_draw_list();
|
if (menu.ProcessKey(key_scancode)) _menu_draw_list();
|
||||||
break;
|
break;
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
DefineAndDrawWindow(menu.appear_x,menu.appear_y,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
|
_menu_exit();
|
||||||
DrawPopup(0,0,menu.w,menu.h+3,0, 0xE4DFE1,0x9098B0);
|
|
||||||
_menu_draw_list();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,7 +73,7 @@
|
|||||||
KillProcess(menu_process_id);
|
KillProcess(menu_process_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
:void _menu_no_item_click()
|
:void _menu_exit()
|
||||||
{
|
{
|
||||||
menu.cur_y = 0;
|
menu.cur_y = 0;
|
||||||
KillProcess(menu_process_id);
|
KillProcess(menu_process_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user