forked from KolibriOS/kolibrios
lmenu: use fix permissions of shared memory; thanks a lot to tsdima
WebView: use lmenu git-svn-id: svn://kolibrios.org@7780 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
fbb2253145
commit
162d120bc4
@ -346,7 +346,10 @@ void TWebBrowser::SetStyle() {
|
||||
return;
|
||||
}
|
||||
if (tag.is("br")) { NewLine(); return; }
|
||||
if (tag.is("b")) || (tag.is("strong")) || (tag.is("big")) { style.b = tag.opened; return; }
|
||||
if (tag.is("b")) || (tag.is("strong")) || (tag.is("big")) {
|
||||
style.b = tag.opened;
|
||||
return;
|
||||
}
|
||||
if (tag.is("a")) {
|
||||
if (tag.opened)
|
||||
{
|
||||
@ -393,7 +396,7 @@ void TWebBrowser::SetStyle() {
|
||||
NewLine();
|
||||
return;
|
||||
}
|
||||
if (tag.is("p")) {
|
||||
if (tag.is("p")) || (tag.is("w:p")) {
|
||||
IF (tag.prior[0] == 'h') || (streq(#tag.prior,"td")) || (streq(#tag.prior,"p")) return;
|
||||
NewLine();
|
||||
return;
|
||||
|
@ -62,6 +62,8 @@ progress_bar wv_progress_bar;
|
||||
char stak[4096];
|
||||
proc_info Form;
|
||||
|
||||
int menu_id=NULL;
|
||||
|
||||
enum {
|
||||
NEW_TAB=600,
|
||||
ENCODINGS=700,
|
||||
@ -203,9 +205,10 @@ void main()
|
||||
break;
|
||||
|
||||
case evReDraw:
|
||||
DefineAndDrawWindow(40, //GetScreenWidth()-800/2-random(80),
|
||||
DefineAndDrawWindow(GetScreenWidth()-800/2-random(80), //40
|
||||
GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0);
|
||||
GetProcessInfo(#Form, SelfInfo);
|
||||
ProcessMenuClick();
|
||||
system.color.get();
|
||||
if (Form.status_window>2) break;
|
||||
if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; }
|
||||
@ -300,11 +303,6 @@ void SetElementSizes()
|
||||
void draw_window()
|
||||
{
|
||||
int i;
|
||||
if (menu.cur_y) {
|
||||
EAX = menu.cur_y;
|
||||
menu.cur_y = 0;
|
||||
ProcessEvent(EAX);
|
||||
}
|
||||
SetElementSizes();
|
||||
|
||||
DrawBar(0,0, Form.cwidth,PADDING, system.color.work);
|
||||
@ -710,27 +708,38 @@ void DrawProgress()
|
||||
|
||||
void EventShowPageMenu()
|
||||
{
|
||||
menu.selected = 0;
|
||||
menu.show(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, 220, #rmb_menu, VIEW_SOURCE);
|
||||
open_lmenu(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, MENU_ALIGN_TOP_LEFT, NULL, #rmb_menu);
|
||||
menu_id = VIEW_SOURCE;
|
||||
}
|
||||
|
||||
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.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);
|
||||
open_lmenu(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, MENU_ALIGN_TOP_LEFT, NULL, #link_menu);
|
||||
menu_id = COPY_LINK_URL;
|
||||
}
|
||||
|
||||
void EventShowMainMenu()
|
||||
{
|
||||
menu.selected = 0;
|
||||
menu.show(Form.left + Form.cwidth - 150, Form.top + skin_height + TOOLBAR_H-8, 140, #main_menu, OPEN_FILE);
|
||||
open_lmenu(Form.left + Form.cwidth - PADDING, Form.top + skin_height + PADDING + TSZE + 3,
|
||||
MENU_ALIGN_TOP_RIGHT, NULL, #main_menu);
|
||||
menu_id = OPEN_FILE;
|
||||
}
|
||||
|
||||
void EventShowEncodingsList()
|
||||
{
|
||||
open_lmenu(Form.left + Form.cwidth, Form.top + skin_height + status_text.start_y + 8,
|
||||
MENU_ALIGN_BOT_RIGHT, WB1.cur_encoding + 1, "UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866");
|
||||
menu_id = ENCODINGS;
|
||||
}
|
||||
|
||||
void ProcessMenuClick()
|
||||
{
|
||||
int click_id;
|
||||
if (menu_id) && (click_id = get_menu_click()) {
|
||||
click_id += menu_id - 1;
|
||||
menu_id = NULL;
|
||||
ProcessEvent(click_id);
|
||||
}
|
||||
}
|
||||
|
||||
void EventUpdateProgressBar()
|
||||
|
12
programs/cmm/browser/build.bat
Normal file
12
programs/cmm/browser/build.bat
Normal file
@ -0,0 +1,12 @@
|
||||
@ECHO OFF
|
||||
|
||||
call "compile_ru.bat"
|
||||
|
||||
if exist WebView (
|
||||
"C:\Program Files (x86)\WinImage\winimage.exe" "D:\Kolibri\Desktop\kolibri.img" /H /Q /I WebView
|
||||
d:
|
||||
cd "D:\Kolibri\Infrastructure\QEMU"
|
||||
call "z_kos.bat"
|
||||
) else (
|
||||
pause
|
||||
)
|
@ -6,4 +6,5 @@
|
||||
@rename WebView.com WebView
|
||||
@del warning.txt
|
||||
@del lang.h--
|
||||
@pause
|
||||
|
||||
if not exist WebView ( @pause )
|
@ -6,4 +6,5 @@
|
||||
@rename WebView.com WebView
|
||||
@del warning.txt
|
||||
@del lang.h--
|
||||
@pause
|
||||
|
||||
if not exist WebView ( @pause )
|
@ -1,4 +1,4 @@
|
||||
char version[]="WebView 2.4a";
|
||||
char version[]="WebView 2.41";
|
||||
|
||||
#ifdef LANG_RUS
|
||||
char page_not_found[] = FROM "html\\page_not_found_ru.htm""\0";
|
||||
@ -6,13 +6,13 @@ char homepage[] = FROM "html\\homepage_ru.htm""\0";
|
||||
char help[] = FROM "html\\help_ru.htm""\0";
|
||||
char accept_language[]= "Accept-Language: ru\n";
|
||||
char rmb_menu[] =
|
||||
"<EFBFBD>®á¬®âà¥âì ¨á室¨ª
|
||||
"<EFBFBD>®á¬®âà¥âì ¨á室¨ª|CTRL+U
|
||||
<EFBFBD>¥¤ ªâ¨à®¢ âì ¨á室¨ª";
|
||||
char main_menu[] =
|
||||
"Žâªàëâì ä ©«
|
||||
<EFBFBD>®¢®¥ ®ª®
|
||||
ˆáâ®à¨ï
|
||||
Œ¥¥¤¦¥à § £à㧮ª
|
||||
"Žâªàëâì ä ©«|CTRL+O
|
||||
<EFBFBD>®¢®¥ ®ª®|CTRL+N
|
||||
ˆáâ®à¨ï|CTRL+H
|
||||
Œ¥¥¤¦¥à § £à㧮ª|CTRL+J
|
||||
Žç¨áâ¨âì ªíè
|
||||
Ž¡®¢¨âì ¡à 㧥à";
|
||||
char link_menu[] =
|
||||
@ -32,13 +32,13 @@ char homepage[] = FROM "html\\homepage_en.htm""\0";
|
||||
char help[] = FROM "html\\help_en.htm""\0";
|
||||
char accept_language[]= "Accept-Language: en\n";
|
||||
char rmb_menu[] =
|
||||
"View source
|
||||
"View source|CTRL+U
|
||||
Edit source";
|
||||
char main_menu[] =
|
||||
"Open local file
|
||||
New window
|
||||
History
|
||||
Download Manager
|
||||
"Open local file|CTRL+O
|
||||
New window|CTRL+N
|
||||
History|CTRL+H
|
||||
Download Manager|CTRL+J
|
||||
Clear cache
|
||||
Update browser";
|
||||
char link_menu[] =
|
||||
|
@ -116,9 +116,9 @@ void EventShowListMenu()
|
||||
|
||||
bool GetMenuClick()
|
||||
{
|
||||
dword chick_id;
|
||||
if (active_menu) && (chick_id = get_menu_click()) {
|
||||
EventMenuClick(chick_id);
|
||||
dword click_id;
|
||||
if (active_menu) && (click_id = get_menu_click()) {
|
||||
EventMenuClick(click_id);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
@ -230,24 +230,7 @@ void SetAppColors()
|
||||
if (col.work == system.color.work) return;
|
||||
old_list_bg_color = col.list_bg;
|
||||
bg_col = system.color.work;
|
||||
if (GrayScaleImage(#bg_col,1,1)>=65)
|
||||
{
|
||||
//use light colors
|
||||
col.def = true;
|
||||
col.list_bg = 0xFFFfff;
|
||||
col.list_gb_text = 0x000000;
|
||||
col.list_text_hidden = 0xA6A6B7;
|
||||
col.list_vert_line = 0xDDD7CF;
|
||||
col.work = system.color.work;
|
||||
col.graph = system.color.work_graph;
|
||||
col.lpanel = 0x00699C;
|
||||
col.selec = col.selec_active = 0x94AECE;
|
||||
col.selec_text = 0x000000;
|
||||
system.color.work_dark = MixColors(0, system.color.work, 35);
|
||||
col.slider_bg_big = 0xCDCFCF;
|
||||
col.odd_line = 0xF1F1F1;
|
||||
}
|
||||
else
|
||||
if (skin_is_dark())
|
||||
{
|
||||
//use dark colors
|
||||
col.def = false;
|
||||
@ -265,6 +248,23 @@ void SetAppColors()
|
||||
col.slider_bg_big = MixColors(0xCED0D0, system.color.work, 35);
|
||||
col.odd_line = MixColors(0xFFFfff, system.color.work, 15);
|
||||
}
|
||||
else
|
||||
{
|
||||
//use light colors
|
||||
col.def = true;
|
||||
col.list_bg = 0xFFFfff;
|
||||
col.list_gb_text = 0x000000;
|
||||
col.list_text_hidden = 0xA6A6B7;
|
||||
col.list_vert_line = 0xDDD7CF;
|
||||
col.work = system.color.work;
|
||||
col.graph = system.color.work_graph;
|
||||
col.lpanel = 0x00699C;
|
||||
col.selec = col.selec_active = 0x94AECE;
|
||||
col.selec_text = 0x000000;
|
||||
system.color.work_dark = MixColors(0, system.color.work, 35);
|
||||
col.slider_bg_big = 0xCDCFCF;
|
||||
col.odd_line = 0xF1F1F1;
|
||||
}
|
||||
col.selec_inactive = MixColors(0xBBBbbb, col.list_bg, 65);
|
||||
col.slider_bg_left = MixColors(col.graph, col.slider_bg_big, 10);
|
||||
for (i=0; i<=20; i++) col.work_gradient[20-i] = MixColors(0, system.color.work, i);
|
||||
|
@ -159,7 +159,7 @@ void main()
|
||||
|
||||
system.color.get();
|
||||
bg_col = system.color.work;
|
||||
if (GrayScaleImage(#bg_col,1,1)<65) bg_dark=true; else bg_dark=false;
|
||||
bg_dark = skin_is_dark();
|
||||
|
||||
semi_white = MixColors(system.color.work, 0xFFFfff, bg_dark*90 + 96);
|
||||
Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffFFFfff, semi_white);
|
||||
|
@ -299,10 +299,17 @@
|
||||
PutPixel(x+w+1, y+h, dark);
|
||||
}
|
||||
|
||||
:bool is_the_skin_dark()
|
||||
:bool skin_is_dark()
|
||||
{
|
||||
dword bg_col = system.color.work;
|
||||
if (GrayScaleImage(#bg_col,1,1)<65) {
|
||||
dword gray;
|
||||
dword color_image = #system.color.work;
|
||||
|
||||
gray = DSBYTE[color_image]*DSBYTE[color_image];
|
||||
gray += DSBYTE[color_image+1]*DSBYTE[color_image+1];
|
||||
gray += DSBYTE[color_image+2]*DSBYTE[color_image+2];
|
||||
gray = sqrt(gray) / 3;
|
||||
|
||||
if (gray < 65) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
@ -79,29 +79,34 @@
|
||||
KillProcess(menu_process_id);
|
||||
}
|
||||
|
||||
#define MENU_ALIGN_TOP_LEFT 0
|
||||
#define MENU_ALIGN_TOP_RIGHT 1
|
||||
#define MENU_ALIGN_BOT_LEFT 2
|
||||
#define MENU_ALIGN_BOT_RIGHT 3
|
||||
|
||||
:dword shared_mem = NULL;
|
||||
:char shared_name[] = "LMENU";
|
||||
:void open_lmenu(dword _x, _y, _position, _selected, _text)
|
||||
{
|
||||
if (!shared_mem) {
|
||||
shared_mem = memopen(#shared_name, 20, SHM_CREATE);
|
||||
if (EDX) shared_mem = memopen(#shared_name, 20, SHM_WRITE);
|
||||
shared_mem = memopen(#shared_name, 16, SHM_CREATE + SHM_WRITE);
|
||||
if (EDX) shared_mem = memopen(#shared_name, 16, SHM_WRITE);
|
||||
}
|
||||
ESDWORD[shared_mem ] = _selected;
|
||||
ESDWORD[shared_mem + 4] = _x;
|
||||
ESDWORD[shared_mem + 8] = _y;
|
||||
ESDWORD[shared_mem + 12] = _position;
|
||||
ESDWORD[shared_mem + 16] = _selected;
|
||||
RunProgram("/sys/develop/menu", _text);
|
||||
menu_process_id = RunProgram("/sys/develop/menu", _text);
|
||||
}
|
||||
|
||||
:dword get_menu_click()
|
||||
{
|
||||
//dword res = ESDWORD[shared_mem];
|
||||
char res[2];
|
||||
ReadFile(0, 2, #res, "/tmp0/1/menu.tmp");
|
||||
//ESDWORD[shared_mem] = 0;
|
||||
return res[0];
|
||||
if (menu_process_id) && (GetProcessSlot(menu_process_id)) {
|
||||
return NULL;
|
||||
} else {
|
||||
menu_process_id = NULL;
|
||||
return ESDWORD[shared_mem];
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -3,15 +3,13 @@ void DrawTopPanelButton(dword _button_id, _x, _y, signed int _icon_n)
|
||||
{
|
||||
#define TSZE 25
|
||||
static libimg_image top_icons;
|
||||
static dword semi_white=0, bg_col, bg_col_light, bg_col_dark, bg_dark;
|
||||
static dword semi_white=0, bg_col_light, bg_col_dark;
|
||||
if (!semi_white) {
|
||||
bg_col = system.color.work;
|
||||
if (GrayScaleImage(#bg_col,1,1)<65) bg_dark=true; else bg_dark=false;
|
||||
Libimg_LoadImage(#top_icons, "/sys/icons16.png");
|
||||
|
||||
semi_white = MixColors(system.color.work, 0xFFFfff, bg_dark*90 + 96);
|
||||
semi_white = MixColors(system.color.work, 0xFFFfff, skin_is_dark()*90 + 96);
|
||||
bg_col_dark = MixColors(system.color.work, system.color.work_graph, 90);
|
||||
bg_col_light = MixColors(semi_white, 0xFFFfff, bg_dark*90 + 10);
|
||||
bg_col_light = MixColors(semi_white, 0xFFFfff, skin_is_dark()*90 + 10);
|
||||
|
||||
Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffFFFfff, semi_white);
|
||||
Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffCACBD6, MixColors(semi_white, 0, 220));
|
||||
|
@ -12,40 +12,39 @@ llist menu1;
|
||||
collection names;
|
||||
collection hotkeys;
|
||||
|
||||
int win_x, win_y;
|
||||
int selected, win_x, win_y;
|
||||
|
||||
int max_name_len;
|
||||
int max_hotkey_len;
|
||||
|
||||
int selected = 0;
|
||||
|
||||
/*
|
||||
dword cur_param = #param;
|
||||
int GetNextParam()
|
||||
{
|
||||
int result;
|
||||
dword next_param = strchr(cur_param, ' ');
|
||||
ESBYTE[next_param] = '\0';
|
||||
result = atoi(cur_param);
|
||||
cur_param = next_param+1;
|
||||
return result;
|
||||
}
|
||||
*/
|
||||
|
||||
void GetWindowPosition()
|
||||
{
|
||||
int position, rez;
|
||||
shared_mem = memopen(#shared_name, 20, SHM_READ);
|
||||
int position;
|
||||
shared_mem = memopen(#shared_name, 16, SHM_OPEN + SHM_WRITE);
|
||||
selected = ESDWORD[shared_mem ];
|
||||
win_x = ESDWORD[shared_mem + 4];
|
||||
win_y = ESDWORD[shared_mem + 8];
|
||||
position = ESDWORD[shared_mem + 12];
|
||||
selected = ESDWORD[shared_mem + 16];
|
||||
if (position==2) win_x -= menu1.w;
|
||||
if (position==3) {
|
||||
if (position == MENU_ALIGN_TOP_RIGHT) win_x -= menu1.w;
|
||||
if (position == MENU_ALIGN_BOT_LEFT) win_y -= menu1.h;
|
||||
if (position == MENU_ALIGN_BOT_RIGHT) {
|
||||
win_x -= menu1.w;
|
||||
win_y -= menu1.h;
|
||||
}
|
||||
if (position==4) win_y -= menu1.h;
|
||||
}
|
||||
|
||||
void GetMenuWidths()
|
||||
{
|
||||
int i;
|
||||
for (i=0; i<names.count; i++) {
|
||||
max_name_len = math.max(max_name_len, strlen(names.get(i)));
|
||||
}
|
||||
for (i=0; i<hotkeys.count; i++) {
|
||||
max_hotkey_len = math.max(max_hotkey_len, strlen(hotkeys.get(i)));
|
||||
}
|
||||
max_name_len = max_name_len * 6;
|
||||
max_hotkey_len *= 6;
|
||||
if (max_hotkey_len) max_name_len += 12;
|
||||
}
|
||||
|
||||
void GetMenuItems(dword current_name)
|
||||
@ -61,7 +60,7 @@ void GetMenuItems(dword current_name)
|
||||
if (hotkey) && (!next_name) {
|
||||
ESBYTE[hotkey] = '\0';
|
||||
} else {
|
||||
hotkey = " ";
|
||||
hotkey = " ";
|
||||
}
|
||||
}
|
||||
|
||||
@ -78,8 +77,7 @@ void main()
|
||||
if (!param) die("'Menu component is for developers only' -I");
|
||||
|
||||
GetMenuItems(#param);
|
||||
max_name_len = strlen(names.get(0)) * 6;
|
||||
max_hotkey_len = strlen(hotkeys.get(0)) * 6;
|
||||
GetMenuWidths();
|
||||
|
||||
menu1.count = names.count;
|
||||
menu1.SetFont(6, 9, 0x80);
|
||||
@ -145,7 +143,7 @@ void draw_list()
|
||||
dword active_top_border_color = MixColors(system.color.work_graph, system.color.work_button,240);
|
||||
dword inactive_text_shadow_color = MixColors(system.color.work,0xFFFfff,150);
|
||||
dword text_color;
|
||||
bool skin_dark = is_the_skin_dark();
|
||||
bool skin_dark = skin_is_dark();
|
||||
|
||||
for (i=0; i<menu1.count; i++;)
|
||||
{
|
||||
@ -164,22 +162,17 @@ void draw_list()
|
||||
}
|
||||
WriteText(13, item_y + menu1.text_y, 0x80, text_color, names.get(i));
|
||||
}
|
||||
if (selected) WriteText(5, selected*ITEM_H + menu1.y + menu1.text_y, 0x80, 0xEE0000, "\x10");
|
||||
if (selected) WriteText(5, selected-1*ITEM_H + menu1.y + menu1.text_y, 0x80, 0xEE0000, "\x10");
|
||||
}
|
||||
|
||||
void click()
|
||||
{
|
||||
char res[2];
|
||||
res[0] = menu1.cur_y + 1;
|
||||
res[1] = '\0';
|
||||
//ESDWORD[shared_mem] = menu1.cur_y + 1;
|
||||
CreateFile(2, #res, "/tmp0/1/menu.tmp");
|
||||
ESDWORD[shared_mem] = menu1.cur_y + 1;
|
||||
ExitProcess();
|
||||
}
|
||||
|
||||
void exit()
|
||||
{
|
||||
//ESDWORD[shared_mem] = 0;
|
||||
CreateFile(2, 0, "/tmp0/1/menu.tmp");
|
||||
ESDWORD[shared_mem] = 0;
|
||||
ExitProcess();
|
||||
}
|
||||
|
@ -130,19 +130,19 @@ void SetAppColors()
|
||||
system.color.get();
|
||||
old_list_bg_color = swc.list_bg;
|
||||
bg_col = system.color.work;
|
||||
if (GrayScaleImage(#bg_col,1,1)>=65)
|
||||
if (skin_is_dark())
|
||||
{
|
||||
//light colors
|
||||
swc.list_bg = 0xF3F3F3;
|
||||
swc.text = 0x000000;
|
||||
swc.dark = 0xDCDCDC;
|
||||
swc.light = 0xFCFCFC;
|
||||
} else {
|
||||
//dark colors
|
||||
swc.list_bg = system.color.work;
|
||||
swc.text = system.color.work_text;
|
||||
swc.dark = system.color.work_dark;
|
||||
swc.light = system.color.work_light;
|
||||
} else {
|
||||
//light colors
|
||||
swc.list_bg = 0xF3F3F3;
|
||||
swc.text = 0x000000;
|
||||
swc.dark = 0xDCDCDC;
|
||||
swc.light = 0xFCFCFC;
|
||||
}
|
||||
|
||||
if (swc.list_bg != old_list_bg_color)
|
||||
|
Loading…
Reference in New Issue
Block a user