forked from KolibriOS/kolibrios
+ special key -app
git-svn-id: svn://kolibrios.org@9348 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
b6bfffebda
commit
dd931d8400
@ -10,9 +10,11 @@ void TWebBrowser::RenderLine(dword _line)
|
||||
if (style.title)
|
||||
{
|
||||
strncpy(#header, _line, sizeof(TWebBrowser.header)-1);
|
||||
if (!application_mode) {
|
||||
strncat(#header, " - ", sizeof(TWebBrowser.header)-1);
|
||||
strncat(#header, #version, sizeof(TWebBrowser.header)-1);
|
||||
}
|
||||
}
|
||||
else if (t_html) && (!t_body) {
|
||||
//
|
||||
}
|
||||
|
@ -45,6 +45,7 @@
|
||||
bool debug_mode = false;
|
||||
bool show_images = true;
|
||||
bool source_mode = false;
|
||||
bool application_mode = false;
|
||||
|
||||
_history history;
|
||||
|
||||
@ -56,15 +57,14 @@ TWebBrowser WB1;
|
||||
|
||||
#include "history.h"
|
||||
|
||||
#define PADDING 9
|
||||
#define TSZE 25
|
||||
#define STATUSBAR_H 15
|
||||
#define TAB_H 20
|
||||
dword TOOLBAR_H = PADDING+TSZE+PADDING+2;
|
||||
dword PADDING = 9;
|
||||
dword TSZE = 25;
|
||||
dword STATUSBAR_H = 15;
|
||||
dword TAB_H = 20;
|
||||
dword TOOLBAR_H = 0;
|
||||
|
||||
_http http = 0;
|
||||
|
||||
|
||||
progress_bar prbar;
|
||||
proc_info Form;
|
||||
|
||||
@ -80,7 +80,7 @@ char default_dir[] = "/rd/1";
|
||||
od_filter filter2 = { 22, "TXT\0HTM\0HTML\0DOCX\0\0" };
|
||||
|
||||
char editURL[URL_SIZE+1];
|
||||
edit_box omnibox_edit = {, PADDING+TSZE*2+PADDING+6, PADDING+3, 0xffffff,
|
||||
edit_box omnibox_edit = {, 0, 0, 0xffffff,
|
||||
0x94AECE, 0xffffff, 0xffffff,0x10000000,URL_SIZE-2,#editURL,0,,19,19};
|
||||
|
||||
//===================================================//
|
||||
@ -110,6 +110,9 @@ void HandleParam()
|
||||
history.add(#param + 8);
|
||||
} else if (!strncmp(#param, "-new ", 5)) {
|
||||
history.add(#param + 5);
|
||||
} else if (!strncmp(#param, "-app ", 5)) {
|
||||
history.add(#param + 5);
|
||||
application_mode = true;
|
||||
} else {
|
||||
if (GetProcessesCount("WEBVIEW") == 1) {
|
||||
history.add(#param);
|
||||
@ -127,8 +130,23 @@ void HandleParam()
|
||||
void main()
|
||||
{
|
||||
int redirect_count=0;
|
||||
|
||||
TOOLBAR_H = PADDING+TSZE+PADDING+2;
|
||||
|
||||
LoadLibraries();
|
||||
HandleParam();
|
||||
|
||||
if (application_mode) {
|
||||
TOOLBAR_H = 0;
|
||||
PADDING = 0;
|
||||
TSZE = 0;
|
||||
STATUSBAR_H = 0;
|
||||
TAB_H = 0;
|
||||
}
|
||||
|
||||
omnibox_edit.left = PADDING+TSZE*2+PADDING+6;
|
||||
omnibox_edit.top = PADDING+3;
|
||||
|
||||
WB1.list.SetFont(8, 14, 10011000b);
|
||||
WB1.list.no_selection = true;
|
||||
WB1.custom_encoding = -1;
|
||||
@ -364,6 +382,7 @@ void draw_window()
|
||||
|
||||
SetElementSizes();
|
||||
|
||||
if (!application_mode) {
|
||||
DrawBar(0,0, Form.cwidth,PADDING, sc.work);
|
||||
DrawBar(0,PADDING+TSZE+1, Form.cwidth,PADDING-1, sc.work);
|
||||
DrawBar(0,TOOLBAR_H-2, Form.cwidth,1, MixColors(sc.work_dark, sc.work, 180));
|
||||
@ -379,6 +398,7 @@ void draw_window()
|
||||
|
||||
DrawRectangle(WB1.list.x + WB1.list.w, WB1.list.y, scroll_wv.size_x,
|
||||
WB1.list.h-1, scroll_wv.bckg_col);
|
||||
}
|
||||
|
||||
if (!canvas.bufw) {
|
||||
EventOpenFirstPage();
|
||||
@ -386,9 +406,12 @@ void draw_window()
|
||||
WB1.DrawPage();
|
||||
DrawOmnibox();
|
||||
}
|
||||
if (!application_mode) {
|
||||
DrawProgress();
|
||||
DrawStatusBar(NULL);
|
||||
DrawTabsBar();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void EventOpenFirstPage()
|
||||
@ -747,6 +770,7 @@ bool UrlExtIs(dword base, ext)
|
||||
void DrawProgress()
|
||||
{
|
||||
dword pct;
|
||||
if (application_mode) return;
|
||||
if (!http.transfer) return;
|
||||
if (http_get_type==PAGE) && (prbar.max) pct = prbar.value*30/prbar.max; else pct = 10;
|
||||
if (http_get_type==IMG) pct = prbar.value * 70 / prbar.max + 30;
|
||||
@ -755,18 +779,21 @@ void DrawProgress()
|
||||
|
||||
void EventShowPageMenu()
|
||||
{
|
||||
if (application_mode) return;
|
||||
open_lmenu(mouse.x, mouse.y, MENU_TOP_LEFT, NULL, #rmb_menu);
|
||||
menu_id = VIEW_SOURCE;
|
||||
}
|
||||
|
||||
void EventShowLinkMenu()
|
||||
{
|
||||
if (application_mode) return;
|
||||
open_lmenu(mouse.x, mouse.y, MENU_TOP_LEFT, NULL, #link_menu);
|
||||
menu_id = IN_NEW_TAB;
|
||||
}
|
||||
|
||||
void EventShowMainMenu()
|
||||
{
|
||||
if (application_mode) return;
|
||||
open_lmenu(Form.cwidth - PADDING -4, PADDING + TSZE + 3,
|
||||
MENU_TOP_RIGHT, NULL, #main_menu);
|
||||
menu_id = OPEN_FILE;
|
||||
@ -774,6 +801,7 @@ void EventShowMainMenu()
|
||||
|
||||
void EventShowEncodingsList()
|
||||
{
|
||||
if (application_mode) return;
|
||||
open_lmenu(Form.cwidth-4, Form.cheight - STATUSBAR_H + 12,
|
||||
MENU_BOT_RIGHT, WB1.cur_encoding + 1,
|
||||
"UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866");
|
||||
@ -858,6 +886,7 @@ void DrawStatusBar(dword _msg)
|
||||
{
|
||||
dword status_y = Form.cheight - STATUSBAR_H + 4;
|
||||
dword status_w = Form.cwidth - 90;
|
||||
if (application_mode) return;
|
||||
if (Form.status_window>2) return;
|
||||
DrawBar(0,Form.cheight - STATUSBAR_H+1, Form.cwidth,STATUSBAR_H-1, sc.work);
|
||||
if (_msg) {
|
||||
@ -871,7 +900,7 @@ void DrawStatusBar(dword _msg)
|
||||
void DrawOmnibox()
|
||||
{
|
||||
int imgxoff;
|
||||
|
||||
if (application_mode) return;
|
||||
DrawOvalBorder(omnibox_edit.left-2, omnibox_edit.top-3, omnibox_edit.width+18, 24, sc.work_graph,
|
||||
sc.work_graph, sc.work_graph, sc.work_dark);
|
||||
DrawBar(omnibox_edit.left-1, omnibox_edit.top-2, omnibox_edit.width+18, 1, 0xD8DCD8);
|
||||
@ -890,6 +919,7 @@ void DrawOmnibox()
|
||||
|
||||
void SetOmniboxText(dword _text)
|
||||
{
|
||||
if (application_mode) return;
|
||||
edit_box_set_text stdcall (#omnibox_edit, _text);
|
||||
omnibox_edit.pos = omnibox_edit.flags = 0;
|
||||
DrawOmnibox();
|
||||
|
Loading…
Reference in New Issue
Block a user