diff --git a/programs/cmm/Calypte/Calypte.c b/programs/cmm/Calypte/Calypte.c index f9a033bec6..3698754cb3 100644 --- a/programs/cmm/Calypte/Calypte.c +++ b/programs/cmm/Calypte/Calypte.c @@ -49,7 +49,7 @@ od_filter filter2 = { 8, "TXT\0\0" }; ?define MENU3 "Reopen" char menu_file_list[] = -"Open +"Open|Ctrl+O Close Properties Exit"; @@ -196,10 +196,7 @@ void main() break; case evReDraw: - if (menu.cur_y) - { - EventMenuClick(); - } + if (CheckActiveProcess(Form.ID)) EventMenuClick(); draw_window(); break; } @@ -268,7 +265,7 @@ void OpenFile(dword _path) } if (encoding!=CH_CP866) { - ChangeCharset(charsets[encoding], "CP866", bufpointer); + ChangeCharset(encoding, "CP866", bufpointer); } } @@ -393,10 +390,11 @@ void DrawVerticalScroll() // EVENTS // // // //===================================================// - +dword menu_id; void EventMenuClick() { - switch(menu.cur_y) + dword click_id = get_menu_click(); + if (click_id) switch(click_id + menu_id - 1) { //File case FILE_SUBMENU_ID_OPEN: @@ -413,7 +411,7 @@ void EventMenuClick() break; //Encoding case MENU_ID_ENCODING...MENU_ID_ENCODING+9: - EventChangeEncoding(menu.cur_y-MENU_ID_ENCODING); + EventChangeEncoding(click_id-1); break; //Reopen case FILE_SUBMENU_ID_TINYPAD: @@ -440,8 +438,9 @@ void EventMenuClick() void EventShowMenu(dword _menu_item_x, _menu_list, _id, _selected) { - menu.selected = _selected; - menu.show(Form.left+5 + _menu_item_x, Form.top+skin_height + TOPPANELH, 140, _menu_list, _id); + open_lmenu(Form.left+5 + _menu_item_x, Form.top+skin_height + TOPPANELH, + MENU_ALIGN_TOP_LEFT, _selected, _menu_list); + menu_id = _id; } void EventOpenFile() diff --git a/programs/cmm/TWB/TWB.c b/programs/cmm/TWB/TWB.c index 5c5d910d56..02065ad775 100644 --- a/programs/cmm/TWB/TWB.c +++ b/programs/cmm/TWB/TWB.c @@ -137,7 +137,7 @@ void TWebBrowser::SetPageDefaults() memmov(o_bufpointer, bufpointer, bufsize); if (custom_encoding != -1) { cur_encoding = custom_encoding; - bufpointer = ChangeCharset(cur_encoding*10+#charsets, "CP866", bufpointer); + bufpointer = ChangeCharset(cur_encoding, "CP866", bufpointer); } } //============================================================================================ @@ -547,9 +547,9 @@ void TWebBrowser::ChangeEncoding(int _new_encoding) { if (cur_encoding == _new_encoding) return; cur_encoding = _new_encoding; - bufpointer = ChangeCharset(cur_encoding*10+#charsets, "CP866", bufpointer); + bufpointer = ChangeCharset(cur_encoding, "CP866", bufpointer); if (header) { - ChangeCharset(cur_encoding*10+#charsets, "CP866", #header); + ChangeCharset(cur_encoding, "CP866", #header); DrawTitle(#header); } } diff --git a/programs/cmm/aelia/prepare_page.h b/programs/cmm/aelia/prepare_page.h index 73636fc894..5fc7aacc8f 100644 --- a/programs/cmm/aelia/prepare_page.h +++ b/programs/cmm/aelia/prepare_page.h @@ -333,7 +333,7 @@ void PreparePage() _dom dom; strcpy(#title, history.current()+strrchr(history.current(),'/')); - ChangeCharset(charsets[encoding], "CP866", io.buffer_data); + ChangeCharset(encoding, "CP866", io.buffer_data); link.clear(); kfont.size.height = 0; diff --git a/programs/cmm/browser/texts.h b/programs/cmm/browser/texts.h index 235b1d91d6..cc10f8ba77 100644 --- a/programs/cmm/browser/texts.h +++ b/programs/cmm/browser/texts.h @@ -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[] = -"Посмотреть исходник|CTRL+U +"Посмотреть исходник|Ctrl+U Редактировать исходник"; char main_menu[] = -"Открыть файл|CTRL+O -Новое окно|CTRL+N -История|CTRL+H -Менеджер загрузок|CTRL+J +"Открыть файл|Ctrl+O +Новое окно|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|CTRL+U +"View source|Ctrl+U Edit source"; char main_menu[] = -"Open local file|CTRL+O -New window|CTRL+N -History|CTRL+H -Download Manager|CTRL+J +"Open local file|Ctrl+O +New window|Ctrl+N +History|Ctrl+H +Download Manager|Ctrl+J Clear cache Update browser"; char link_menu[] = diff --git a/programs/cmm/eolite/include/menu.h b/programs/cmm/eolite/include/menu.h index 626e65da34..2d62e312c8 100644 --- a/programs/cmm/eolite/include/menu.h +++ b/programs/cmm/eolite/include/menu.h @@ -111,7 +111,7 @@ void EventShowListMenu() text = #file_actions; active_menu = MENU_FILE; } - open_lmenu(mouse.x+Form.left+5, mouse.y+Form.top+3+skin_height, 1, 0, text); + open_lmenu(mouse.x+Form.left+5, mouse.y+Form.top+3+skin_height, MENU_ALIGN_TOP_LEFT, NULL, text); } bool GetMenuClick() @@ -122,7 +122,5 @@ bool GetMenuClick() return false; } return true; - - } diff --git a/programs/cmm/iconedit/iconedit.c b/programs/cmm/iconedit/iconedit.c index f8d514000c..5976bdfedf 100644 --- a/programs/cmm/iconedit/iconedit.c +++ b/programs/cmm/iconedit/iconedit.c @@ -277,7 +277,7 @@ void main() case evReDraw: Window_CanvasReSize.thread_exists(); - EventCheckMenuItemSelected(); + if (CheckActiveProcess(Form.ID)) EventCheckMenuItemSelected(); DrawWindow(); break; } @@ -726,20 +726,19 @@ void EventCrop() void EventShowImageMenu() { - menu.selected = 0; - menu.show(Form.left+5 + image_menu_btn.x, - Form.top+skin_height + image_menu_btn.y + image_menu_btn.h, - 240, - #image_menu_items, - 20); + open_lmenu(Form.left+5 + image_menu_btn.x, Form.top+skin_height + + image_menu_btn.y + image_menu_btn.h, MENU_ALIGN_TOP_LEFT, NULL, #image_menu_items); } void EventCheckMenuItemSelected() { - if (menu.cur_y) { - if (20 == menu.cur_y) EventCountColorsUsed(); - if (21 == menu.cur_y) EventReplaceImageColors(color1, color2); - menu.cur_y = 0; + switch(get_menu_click()) { + case 1: + EventCountColorsUsed(); + break; + case 2: + EventReplaceImageColors(color1, color2); + break; } } diff --git a/programs/cmm/lib/gui/menu.h b/programs/cmm/lib/gui/menu.h index 35ced1ea9c..1bd4be1b34 100644 --- a/programs/cmm/lib/gui/menu.h +++ b/programs/cmm/lib/gui/menu.h @@ -105,7 +105,9 @@ return NULL; } else { menu_process_id = NULL; - return ESDWORD[shared_mem]; + EAX = ESDWORD[shared_mem]; + ESDWORD[shared_mem] = 0; + return EAX; } } diff --git a/programs/cmm/lib/obj/iconv.h b/programs/cmm/lib/obj/iconv.h index 87615120a1..410f3bd50b 100644 --- a/programs/cmm/lib/obj/iconv.h +++ b/programs/cmm/lib/obj/iconv.h @@ -23,6 +23,8 @@ dword ChangeCharset(dword from_chs, to_chs, conv_buf) { dword cd, in_len, out_len, new_buf; + from_chs = from_chs*10+#charsets; + debug("iconv: from_chs = "); debugln(from_chs); debug("iconv: to_chs = "); debugln(to_chs); diff --git a/programs/cmm/txtread/txtread.c b/programs/cmm/txtread/txtread.c index e631167777..3ad655248c 100644 --- a/programs/cmm/txtread/txtread.c +++ b/programs/cmm/txtread/txtread.c @@ -97,6 +97,8 @@ int encoding; dword bg_color; dword text_color; +dword menu_id; + //===================================================// // // // INTERNAL INCLUDES // @@ -148,7 +150,7 @@ void main() HandleButtonEvent(); break; case evReDraw: - EventMenuClick(); + if (CheckActiveProcess(Form.ID)) EventMenuClick(); draw_window(); } } @@ -295,22 +297,23 @@ void EventMagnifyMinus() void EventShowEncodingList() { - menu.selected = encoding + 1; - menu.show(Form.left+5 + charsets_mx, Form.top+29+skin_height, 130, - "UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866", 10); + open_lmenu(Form.left+5 + charsets_mx, Form.top+29+skin_height, MENU_ALIGN_TOP_LEFT, encoding+1, + "UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866"); + menu_id = 10; } void EventShowReopenMenu() { - menu.selected = 0; - menu.show(Form.left+5 + reopenin_mx, Form.top+29+skin_height, 130, - "Tinypad\nTextEdit\nWebView\nFB2Read\nHexView\nOther", 20); + open_lmenu(Form.left+5 + reopenin_mx, Form.top+29+skin_height, MENU_ALIGN_TOP_LEFT, 0, + "Tinypad\nTextEdit\nWebView\nFB2Read\nHexView\nOther"); + menu_id = 20; } void EventShowColorSchemesList() { - menu.selected = curcol_scheme + 1; - menu.show(Form.left+5 + colscheme_mx, Form.top+29+skin_height, 175, #color_scheme_names, 30); + open_lmenu(Form.left+5 + colscheme_mx, Form.top+29+skin_height, MENU_ALIGN_TOP_LEFT, + curcol_scheme+1, #color_scheme_names); + menu_id = 30; } void EventSetColorScheme(dword _setn) @@ -343,11 +346,12 @@ void EventOpenFileInAnotherProgram(dword _app) void EventMenuClick() { byte open_param[4096]; - switch(menu.cur_y) + dword click_id = get_menu_click(); + if (click_id) switch(click_id + menu_id - 1) { //Encoding case 10...15: - EventChangeEncoding(menu.cur_y-10); + EventChangeEncoding(click_id-1); break; //Reopen case 20: @@ -372,11 +376,10 @@ void EventMenuClick() break; //ColorSchemes case 30...38: - EventSetColorScheme(menu.cur_y-30); + EventSetColorScheme(click_id-1); PreparePage(); break; } - menu.cur_y = 0; } //===================================================// @@ -399,7 +402,7 @@ void OpenFile(dword f_path) io.buffer_data = INTRO_TEXT; strcpy(#title, "Text Reader"); } - if (encoding!=CH_CP866) ChangeCharset(charsets[encoding], "CP866", io.buffer_data); + if (encoding!=CH_CP866) ChangeCharset(encoding, "CP866", io.buffer_data); list.KeyHome(); list.ClearList(); }