forked from KolibriOS/kolibrios
CMM Menu: now used in TxtRead, Calypte, IconEdit
git-svn-id: svn://kolibrios.org@7781 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
162d120bc4
commit
17f2ee8344
@ -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()
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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>®á¬®âà¥âì ¨á室¨ª|CTRL+U
|
||||
"<EFBFBD>®á¬®âà¥âì ¨á室¨ª|Ctrl+U
|
||||
<EFBFBD>¥¤ ªâ¨à®¢ âì ¨á室¨ª";
|
||||
char main_menu[] =
|
||||
"Žâªàëâì ä ©«|CTRL+O
|
||||
<EFBFBD>®¢®¥ ®ª®|CTRL+N
|
||||
ˆáâ®à¨ï|CTRL+H
|
||||
Œ¥¥¤¦¥à § £à㧮ª|CTRL+J
|
||||
"Žâªàëâì ä ©«|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|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[] =
|
||||
|
@ -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;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user