From dd931d8400b307f4b3396071244eab0ddf36a1ff Mon Sep 17 00:00:00 2001 From: pavelyakov Date: Wed, 1 Dec 2021 12:30:40 +0000 Subject: [PATCH] + special key -app git-svn-id: svn://kolibrios.org@9348 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/cmm/browser/TWB/render.h | 6 ++- programs/cmm/browser/WebView.c | 84 +++++++++++++++++++++---------- 2 files changed, 61 insertions(+), 29 deletions(-) diff --git a/programs/cmm/browser/TWB/render.h b/programs/cmm/browser/TWB/render.h index b1d2002b4d..c09369a116 100644 --- a/programs/cmm/browser/TWB/render.h +++ b/programs/cmm/browser/TWB/render.h @@ -10,8 +10,10 @@ void TWebBrowser::RenderLine(dword _line) if (style.title) { strncpy(#header, _line, sizeof(TWebBrowser.header)-1); - strncat(#header, " - ", sizeof(TWebBrowser.header)-1); - strncat(#header, #version, 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) { // diff --git a/programs/cmm/browser/WebView.c b/programs/cmm/browser/WebView.c index 0fbd6e30dc..8e3f184735 100644 --- a/programs/cmm/browser/WebView.c +++ b/programs/cmm/browser/WebView.c @@ -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,7 +110,10 @@ void HandleParam() history.add(#param + 8); } else if (!strncmp(#param, "-new ", 5)) { history.add(#param + 5); - } else { + } else if (!strncmp(#param, "-app ", 5)) { + history.add(#param + 5); + application_mode = true; + } else { if (GetProcessesCount("WEBVIEW") == 1) { history.add(#param); } else { @@ -127,8 +130,23 @@ void HandleParam() void main() { int redirect_count=0; + + TOOLBAR_H = PADDING+TSZE+PADDING+2; + LoadLibraries(); - HandleParam(); + 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,21 +382,23 @@ void draw_window() SetElementSizes(); - 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)); - DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, sc.work_graph); - DrawBar(0, PADDING, omnibox_edit.left-2, TSZE+1, sc.work); - DrawBar(omnibox_edit.left+omnibox_edit.width+18, PADDING, Form.cwidth-omnibox_edit.left-omnibox_edit.width-18, TSZE+1, sc.work); + 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)); + DrawBar(0,TOOLBAR_H-1, Form.cwidth,1, sc.work_graph); + DrawBar(0, PADDING, omnibox_edit.left-2, TSZE+1, sc.work); + DrawBar(omnibox_edit.left+omnibox_edit.width+18, PADDING, Form.cwidth-omnibox_edit.left-omnibox_edit.width-18, TSZE+1, sc.work); - DrawTopPanelButton(BACK_BUTTON, PADDING-1, PADDING, 30, false); - DrawTopPanelButton(FORWARD_BUTTON, PADDING+TSZE+PADDING-2, PADDING, 31, false); - DrawTopPanelButton(SANDWICH_BUTTON, Form.cwidth-PADDING-TSZE-3, PADDING, -1, burger_active); //burger menu + DrawTopPanelButton(BACK_BUTTON, PADDING-1, PADDING, 30, false); + DrawTopPanelButton(FORWARD_BUTTON, PADDING+TSZE+PADDING-2, PADDING, 31, false); + DrawTopPanelButton(SANDWICH_BUTTON, Form.cwidth-PADDING-TSZE-3, PADDING, -1, burger_active); //burger menu - DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, sc.work_graph); + DrawBar(0,Form.cheight - STATUSBAR_H, Form.cwidth,1, sc.work_graph); - DrawRectangle(WB1.list.x + WB1.list.w, WB1.list.y, scroll_wv.size_x, + 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(); } - DrawProgress(); - DrawStatusBar(NULL); - DrawTabsBar(); + 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,9 +919,10 @@ void DrawOmnibox() void SetOmniboxText(dword _text) { - edit_box_set_text stdcall (#omnibox_edit, _text); - omnibox_edit.pos = omnibox_edit.flags = 0; - DrawOmnibox(); + if (application_mode) return; + edit_box_set_text stdcall (#omnibox_edit, _text); + omnibox_edit.pos = omnibox_edit.flags = 0; + DrawOmnibox(); } dword GetAbsoluteActiveURL()