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;
|
return;
|
||||||
}
|
}
|
||||||
if (tag.is("br")) { NewLine(); 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.is("a")) {
|
||||||
if (tag.opened)
|
if (tag.opened)
|
||||||
{
|
{
|
||||||
@ -393,7 +396,7 @@ void TWebBrowser::SetStyle() {
|
|||||||
NewLine();
|
NewLine();
|
||||||
return;
|
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;
|
IF (tag.prior[0] == 'h') || (streq(#tag.prior,"td")) || (streq(#tag.prior,"p")) return;
|
||||||
NewLine();
|
NewLine();
|
||||||
return;
|
return;
|
||||||
|
@ -62,6 +62,8 @@ progress_bar wv_progress_bar;
|
|||||||
char stak[4096];
|
char stak[4096];
|
||||||
proc_info Form;
|
proc_info Form;
|
||||||
|
|
||||||
|
int menu_id=NULL;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
NEW_TAB=600,
|
NEW_TAB=600,
|
||||||
ENCODINGS=700,
|
ENCODINGS=700,
|
||||||
@ -203,9 +205,10 @@ void main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case evReDraw:
|
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);
|
GetScreenHeight()-700/2-random(80),800,700,0x73,0,0,0);
|
||||||
GetProcessInfo(#Form, SelfInfo);
|
GetProcessInfo(#Form, SelfInfo);
|
||||||
|
ProcessMenuClick();
|
||||||
system.color.get();
|
system.color.get();
|
||||||
if (Form.status_window>2) break;
|
if (Form.status_window>2) break;
|
||||||
if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; }
|
if (Form.height<120) { MoveSize(OLD,OLD,OLD,120); break; }
|
||||||
@ -300,11 +303,6 @@ 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);
|
||||||
@ -710,27 +708,38 @@ void DrawProgress()
|
|||||||
|
|
||||||
void EventShowPageMenu()
|
void EventShowPageMenu()
|
||||||
{
|
{
|
||||||
menu.selected = 0;
|
open_lmenu(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, MENU_ALIGN_TOP_LEFT, NULL, #rmb_menu);
|
||||||
menu.show(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, 220, #rmb_menu, VIEW_SOURCE);
|
menu_id = VIEW_SOURCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventShowLinkMenu()
|
void EventShowLinkMenu()
|
||||||
{
|
{
|
||||||
menu.selected = 0;
|
open_lmenu(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, MENU_ALIGN_TOP_LEFT, NULL, #link_menu);
|
||||||
menu.show(Form.left + mouse.x+4, Form.top + skin_height + mouse.y, 220, #link_menu, COPY_LINK_URL);
|
menu_id = 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventShowMainMenu()
|
void EventShowMainMenu()
|
||||||
{
|
{
|
||||||
menu.selected = 0;
|
open_lmenu(Form.left + Form.cwidth - PADDING, Form.top + skin_height + PADDING + TSZE + 3,
|
||||||
menu.show(Form.left + Form.cwidth - 150, Form.top + skin_height + TOOLBAR_H-8, 140, #main_menu, OPEN_FILE);
|
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()
|
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
|
@rename WebView.com WebView
|
||||||
@del warning.txt
|
@del warning.txt
|
||||||
@del lang.h--
|
@del lang.h--
|
||||||
@pause
|
|
||||||
|
if not exist WebView ( @pause )
|
@ -6,4 +6,5 @@
|
|||||||
@rename WebView.com WebView
|
@rename WebView.com WebView
|
||||||
@del warning.txt
|
@del warning.txt
|
||||||
@del lang.h--
|
@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
|
#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";
|
||||||
@ -6,13 +6,13 @@ char homepage[] = FROM "html\\homepage_ru.htm""\0";
|
|||||||
char help[] = FROM "html\\help_ru.htm""\0";
|
char help[] = FROM "html\\help_ru.htm""\0";
|
||||||
char accept_language[]= "Accept-Language: ru\n";
|
char accept_language[]= "Accept-Language: ru\n";
|
||||||
char rmb_menu[] =
|
char rmb_menu[] =
|
||||||
"<EFBFBD>®á¬®âà¥âì ¨á室¨ª
|
"<EFBFBD>®á¬®âà¥âì ¨á室¨ª|CTRL+U
|
||||||
<EFBFBD>¥¤ ªâ¨à®¢ âì ¨á室¨ª";
|
<EFBFBD>¥¤ ªâ¨à®¢ âì ¨á室¨ª";
|
||||||
char main_menu[] =
|
char main_menu[] =
|
||||||
"Žâªàëâì ä ©«
|
"Žâªàëâì ä ©«|CTRL+O
|
||||||
<EFBFBD>®¢®¥ ®ª®
|
<EFBFBD>®¢®¥ ®ª®|CTRL+N
|
||||||
ˆáâ®à¨ï
|
ˆáâ®à¨ï|CTRL+H
|
||||||
Œ¥¥¤¦¥à § £à㧮ª
|
Œ¥¥¤¦¥à § £à㧮ª|CTRL+J
|
||||||
Žç¨áâ¨âì ªíè
|
Žç¨áâ¨âì ªíè
|
||||||
Ž¡®¢¨âì ¡à 㧥à";
|
Ž¡®¢¨âì ¡à 㧥à";
|
||||||
char link_menu[] =
|
char link_menu[] =
|
||||||
@ -32,13 +32,13 @@ char homepage[] = FROM "html\\homepage_en.htm""\0";
|
|||||||
char help[] = FROM "html\\help_en.htm""\0";
|
char help[] = FROM "html\\help_en.htm""\0";
|
||||||
char accept_language[]= "Accept-Language: en\n";
|
char accept_language[]= "Accept-Language: en\n";
|
||||||
char rmb_menu[] =
|
char rmb_menu[] =
|
||||||
"View source
|
"View source|CTRL+U
|
||||||
Edit source";
|
Edit source";
|
||||||
char main_menu[] =
|
char main_menu[] =
|
||||||
"Open local file
|
"Open local file|CTRL+O
|
||||||
New window
|
New window|CTRL+N
|
||||||
History
|
History|CTRL+H
|
||||||
Download Manager
|
Download Manager|CTRL+J
|
||||||
Clear cache
|
Clear cache
|
||||||
Update browser";
|
Update browser";
|
||||||
char link_menu[] =
|
char link_menu[] =
|
||||||
|
@ -116,9 +116,9 @@ void EventShowListMenu()
|
|||||||
|
|
||||||
bool GetMenuClick()
|
bool GetMenuClick()
|
||||||
{
|
{
|
||||||
dword chick_id;
|
dword click_id;
|
||||||
if (active_menu) && (chick_id = get_menu_click()) {
|
if (active_menu) && (click_id = get_menu_click()) {
|
||||||
EventMenuClick(chick_id);
|
EventMenuClick(click_id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -230,24 +230,7 @@ void SetAppColors()
|
|||||||
if (col.work == system.color.work) return;
|
if (col.work == system.color.work) return;
|
||||||
old_list_bg_color = col.list_bg;
|
old_list_bg_color = col.list_bg;
|
||||||
bg_col = system.color.work;
|
bg_col = system.color.work;
|
||||||
if (GrayScaleImage(#bg_col,1,1)>=65)
|
if (skin_is_dark())
|
||||||
{
|
|
||||||
//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
|
|
||||||
{
|
{
|
||||||
//use dark colors
|
//use dark colors
|
||||||
col.def = false;
|
col.def = false;
|
||||||
@ -265,6 +248,23 @@ void SetAppColors()
|
|||||||
col.slider_bg_big = MixColors(0xCED0D0, system.color.work, 35);
|
col.slider_bg_big = MixColors(0xCED0D0, system.color.work, 35);
|
||||||
col.odd_line = MixColors(0xFFFfff, system.color.work, 15);
|
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.selec_inactive = MixColors(0xBBBbbb, col.list_bg, 65);
|
||||||
col.slider_bg_left = MixColors(col.graph, col.slider_bg_big, 10);
|
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);
|
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();
|
system.color.get();
|
||||||
bg_col = system.color.work;
|
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);
|
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);
|
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);
|
PutPixel(x+w+1, y+h, dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
:bool is_the_skin_dark()
|
:bool skin_is_dark()
|
||||||
{
|
{
|
||||||
dword bg_col = system.color.work;
|
dword gray;
|
||||||
if (GrayScaleImage(#bg_col,1,1)<65) {
|
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;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -79,29 +79,34 @@
|
|||||||
KillProcess(menu_process_id);
|
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;
|
:dword shared_mem = NULL;
|
||||||
:char shared_name[] = "LMENU";
|
:char shared_name[] = "LMENU";
|
||||||
:void open_lmenu(dword _x, _y, _position, _selected, _text)
|
:void open_lmenu(dword _x, _y, _position, _selected, _text)
|
||||||
{
|
{
|
||||||
if (!shared_mem) {
|
if (!shared_mem) {
|
||||||
shared_mem = memopen(#shared_name, 20, SHM_CREATE);
|
shared_mem = memopen(#shared_name, 16, SHM_CREATE + SHM_WRITE);
|
||||||
if (EDX) shared_mem = memopen(#shared_name, 20, SHM_WRITE);
|
if (EDX) shared_mem = memopen(#shared_name, 16, SHM_WRITE);
|
||||||
}
|
}
|
||||||
|
ESDWORD[shared_mem ] = _selected;
|
||||||
ESDWORD[shared_mem + 4] = _x;
|
ESDWORD[shared_mem + 4] = _x;
|
||||||
ESDWORD[shared_mem + 8] = _y;
|
ESDWORD[shared_mem + 8] = _y;
|
||||||
ESDWORD[shared_mem + 12] = _position;
|
ESDWORD[shared_mem + 12] = _position;
|
||||||
ESDWORD[shared_mem + 16] = _selected;
|
menu_process_id = RunProgram("/sys/develop/menu", _text);
|
||||||
RunProgram("/sys/develop/menu", _text);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
:dword get_menu_click()
|
:dword get_menu_click()
|
||||||
{
|
{
|
||||||
//dword res = ESDWORD[shared_mem];
|
if (menu_process_id) && (GetProcessSlot(menu_process_id)) {
|
||||||
char res[2];
|
return NULL;
|
||||||
ReadFile(0, 2, #res, "/tmp0/1/menu.tmp");
|
} else {
|
||||||
//ESDWORD[shared_mem] = 0;
|
menu_process_id = NULL;
|
||||||
return res[0];
|
return ESDWORD[shared_mem];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
@ -3,15 +3,13 @@ void DrawTopPanelButton(dword _button_id, _x, _y, signed int _icon_n)
|
|||||||
{
|
{
|
||||||
#define TSZE 25
|
#define TSZE 25
|
||||||
static libimg_image top_icons;
|
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) {
|
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");
|
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_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, 0xffFFFfff, semi_white);
|
||||||
Libimg_ReplaceColor(top_icons.image, top_icons.w, top_icons.h, 0xffCACBD6, MixColors(semi_white, 0, 220));
|
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 names;
|
||||||
collection hotkeys;
|
collection hotkeys;
|
||||||
|
|
||||||
int win_x, win_y;
|
int selected, win_x, win_y;
|
||||||
|
|
||||||
int max_name_len;
|
int max_name_len;
|
||||||
int max_hotkey_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()
|
void GetWindowPosition()
|
||||||
{
|
{
|
||||||
int position, rez;
|
int position;
|
||||||
shared_mem = memopen(#shared_name, 20, SHM_READ);
|
shared_mem = memopen(#shared_name, 16, SHM_OPEN + SHM_WRITE);
|
||||||
|
selected = ESDWORD[shared_mem ];
|
||||||
win_x = ESDWORD[shared_mem + 4];
|
win_x = ESDWORD[shared_mem + 4];
|
||||||
win_y = ESDWORD[shared_mem + 8];
|
win_y = ESDWORD[shared_mem + 8];
|
||||||
position = ESDWORD[shared_mem + 12];
|
position = ESDWORD[shared_mem + 12];
|
||||||
selected = ESDWORD[shared_mem + 16];
|
if (position == MENU_ALIGN_TOP_RIGHT) win_x -= menu1.w;
|
||||||
if (position==2) win_x -= menu1.w;
|
if (position == MENU_ALIGN_BOT_LEFT) win_y -= menu1.h;
|
||||||
if (position==3) {
|
if (position == MENU_ALIGN_BOT_RIGHT) {
|
||||||
win_x -= menu1.w;
|
win_x -= menu1.w;
|
||||||
win_y -= menu1.h;
|
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)
|
void GetMenuItems(dword current_name)
|
||||||
@ -61,7 +60,7 @@ void GetMenuItems(dword current_name)
|
|||||||
if (hotkey) && (!next_name) {
|
if (hotkey) && (!next_name) {
|
||||||
ESBYTE[hotkey] = '\0';
|
ESBYTE[hotkey] = '\0';
|
||||||
} else {
|
} else {
|
||||||
hotkey = " ";
|
hotkey = " ";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,8 +77,7 @@ void main()
|
|||||||
if (!param) die("'Menu component is for developers only' -I");
|
if (!param) die("'Menu component is for developers only' -I");
|
||||||
|
|
||||||
GetMenuItems(#param);
|
GetMenuItems(#param);
|
||||||
max_name_len = strlen(names.get(0)) * 6;
|
GetMenuWidths();
|
||||||
max_hotkey_len = strlen(hotkeys.get(0)) * 6;
|
|
||||||
|
|
||||||
menu1.count = names.count;
|
menu1.count = names.count;
|
||||||
menu1.SetFont(6, 9, 0x80);
|
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 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 inactive_text_shadow_color = MixColors(system.color.work,0xFFFfff,150);
|
||||||
dword text_color;
|
dword text_color;
|
||||||
bool skin_dark = is_the_skin_dark();
|
bool skin_dark = skin_is_dark();
|
||||||
|
|
||||||
for (i=0; i<menu1.count; i++;)
|
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));
|
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()
|
void click()
|
||||||
{
|
{
|
||||||
char res[2];
|
ESDWORD[shared_mem] = menu1.cur_y + 1;
|
||||||
res[0] = menu1.cur_y + 1;
|
|
||||||
res[1] = '\0';
|
|
||||||
//ESDWORD[shared_mem] = menu1.cur_y + 1;
|
|
||||||
CreateFile(2, #res, "/tmp0/1/menu.tmp");
|
|
||||||
ExitProcess();
|
ExitProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
void exit()
|
void exit()
|
||||||
{
|
{
|
||||||
//ESDWORD[shared_mem] = 0;
|
ESDWORD[shared_mem] = 0;
|
||||||
CreateFile(2, 0, "/tmp0/1/menu.tmp");
|
|
||||||
ExitProcess();
|
ExitProcess();
|
||||||
}
|
}
|
||||||
|
@ -130,19 +130,19 @@ void SetAppColors()
|
|||||||
system.color.get();
|
system.color.get();
|
||||||
old_list_bg_color = swc.list_bg;
|
old_list_bg_color = swc.list_bg;
|
||||||
bg_col = system.color.work;
|
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
|
//dark colors
|
||||||
swc.list_bg = system.color.work;
|
swc.list_bg = system.color.work;
|
||||||
swc.text = system.color.work_text;
|
swc.text = system.color.work_text;
|
||||||
swc.dark = system.color.work_dark;
|
swc.dark = system.color.work_dark;
|
||||||
swc.light = system.color.work_light;
|
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)
|
if (swc.list_bg != old_list_bg_color)
|
||||||
|
Loading…
Reference in New Issue
Block a user