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"
|
?define MENU3 "Reopen"
|
||||||
|
|
||||||
char menu_file_list[] =
|
char menu_file_list[] =
|
||||||
"Open
|
"Open|Ctrl+O
|
||||||
Close
|
Close
|
||||||
Properties
|
Properties
|
||||||
Exit";
|
Exit";
|
||||||
@ -196,10 +196,7 @@ void main()
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
if (menu.cur_y)
|
if (CheckActiveProcess(Form.ID)) EventMenuClick();
|
||||||
{
|
|
||||||
EventMenuClick();
|
|
||||||
}
|
|
||||||
draw_window();
|
draw_window();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -268,7 +265,7 @@ void OpenFile(dword _path)
|
|||||||
}
|
}
|
||||||
if (encoding!=CH_CP866)
|
if (encoding!=CH_CP866)
|
||||||
{
|
{
|
||||||
ChangeCharset(charsets[encoding], "CP866", bufpointer);
|
ChangeCharset(encoding, "CP866", bufpointer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,10 +390,11 @@ void DrawVerticalScroll()
|
|||||||
// EVENTS //
|
// EVENTS //
|
||||||
// //
|
// //
|
||||||
//===================================================//
|
//===================================================//
|
||||||
|
dword menu_id;
|
||||||
void EventMenuClick()
|
void EventMenuClick()
|
||||||
{
|
{
|
||||||
switch(menu.cur_y)
|
dword click_id = get_menu_click();
|
||||||
|
if (click_id) switch(click_id + menu_id - 1)
|
||||||
{
|
{
|
||||||
//File
|
//File
|
||||||
case FILE_SUBMENU_ID_OPEN:
|
case FILE_SUBMENU_ID_OPEN:
|
||||||
@ -413,7 +411,7 @@ void EventMenuClick()
|
|||||||
break;
|
break;
|
||||||
//Encoding
|
//Encoding
|
||||||
case MENU_ID_ENCODING...MENU_ID_ENCODING+9:
|
case MENU_ID_ENCODING...MENU_ID_ENCODING+9:
|
||||||
EventChangeEncoding(menu.cur_y-MENU_ID_ENCODING);
|
EventChangeEncoding(click_id-1);
|
||||||
break;
|
break;
|
||||||
//Reopen
|
//Reopen
|
||||||
case FILE_SUBMENU_ID_TINYPAD:
|
case FILE_SUBMENU_ID_TINYPAD:
|
||||||
@ -440,8 +438,9 @@ void EventMenuClick()
|
|||||||
|
|
||||||
void EventShowMenu(dword _menu_item_x, _menu_list, _id, _selected)
|
void EventShowMenu(dword _menu_item_x, _menu_list, _id, _selected)
|
||||||
{
|
{
|
||||||
menu.selected = _selected;
|
open_lmenu(Form.left+5 + _menu_item_x, Form.top+skin_height + TOPPANELH,
|
||||||
menu.show(Form.left+5 + _menu_item_x, Form.top+skin_height + TOPPANELH, 140, _menu_list, _id);
|
MENU_ALIGN_TOP_LEFT, _selected, _menu_list);
|
||||||
|
menu_id = _id;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventOpenFile()
|
void EventOpenFile()
|
||||||
|
@ -137,7 +137,7 @@ void TWebBrowser::SetPageDefaults()
|
|||||||
memmov(o_bufpointer, bufpointer, bufsize);
|
memmov(o_bufpointer, bufpointer, bufsize);
|
||||||
if (custom_encoding != -1) {
|
if (custom_encoding != -1) {
|
||||||
cur_encoding = custom_encoding;
|
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;
|
if (cur_encoding == _new_encoding) return;
|
||||||
cur_encoding = _new_encoding;
|
cur_encoding = _new_encoding;
|
||||||
bufpointer = ChangeCharset(cur_encoding*10+#charsets, "CP866", bufpointer);
|
bufpointer = ChangeCharset(cur_encoding, "CP866", bufpointer);
|
||||||
if (header) {
|
if (header) {
|
||||||
ChangeCharset(cur_encoding*10+#charsets, "CP866", #header);
|
ChangeCharset(cur_encoding, "CP866", #header);
|
||||||
DrawTitle(#header);
|
DrawTitle(#header);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -333,7 +333,7 @@ void PreparePage()
|
|||||||
_dom dom;
|
_dom dom;
|
||||||
|
|
||||||
strcpy(#title, history.current()+strrchr(history.current(),'/'));
|
strcpy(#title, history.current()+strrchr(history.current(),'/'));
|
||||||
ChangeCharset(charsets[encoding], "CP866", io.buffer_data);
|
ChangeCharset(encoding, "CP866", io.buffer_data);
|
||||||
link.clear();
|
link.clear();
|
||||||
|
|
||||||
kfont.size.height = 0;
|
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 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>®á¬®âà¥âì ¨á室¨ª|CTRL+U
|
"<EFBFBD>®á¬®âà¥âì ¨á室¨ª|Ctrl+U
|
||||||
<EFBFBD>¥¤ ªâ¨à®¢ âì ¨á室¨ª";
|
<EFBFBD>¥¤ ªâ¨à®¢ âì ¨á室¨ª";
|
||||||
char main_menu[] =
|
char main_menu[] =
|
||||||
"Žâªàëâì ä ©«|CTRL+O
|
"Žâªàëâì ä ©«|Ctrl+O
|
||||||
<EFBFBD>®¢®¥ ®ª®|CTRL+N
|
<EFBFBD>®¢®¥ ®ª®|Ctrl+N
|
||||||
ˆáâ®à¨ï|CTRL+H
|
ˆáâ®à¨ï|Ctrl+H
|
||||||
Œ¥¥¤¦¥à § £à㧮ª|CTRL+J
|
Œ¥¥¤¦¥à § £à㧮ª|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|CTRL+U
|
"View source|Ctrl+U
|
||||||
Edit source";
|
Edit source";
|
||||||
char main_menu[] =
|
char main_menu[] =
|
||||||
"Open local file|CTRL+O
|
"Open local file|Ctrl+O
|
||||||
New window|CTRL+N
|
New window|Ctrl+N
|
||||||
History|CTRL+H
|
History|Ctrl+H
|
||||||
Download Manager|CTRL+J
|
Download Manager|Ctrl+J
|
||||||
Clear cache
|
Clear cache
|
||||||
Update browser";
|
Update browser";
|
||||||
char link_menu[] =
|
char link_menu[] =
|
||||||
|
@ -111,7 +111,7 @@ void EventShowListMenu()
|
|||||||
text = #file_actions;
|
text = #file_actions;
|
||||||
active_menu = MENU_FILE;
|
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()
|
bool GetMenuClick()
|
||||||
@ -122,7 +122,5 @@ bool GetMenuClick()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +277,7 @@ void main()
|
|||||||
|
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
Window_CanvasReSize.thread_exists();
|
Window_CanvasReSize.thread_exists();
|
||||||
EventCheckMenuItemSelected();
|
if (CheckActiveProcess(Form.ID)) EventCheckMenuItemSelected();
|
||||||
DrawWindow();
|
DrawWindow();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -726,20 +726,19 @@ void EventCrop()
|
|||||||
|
|
||||||
void EventShowImageMenu()
|
void EventShowImageMenu()
|
||||||
{
|
{
|
||||||
menu.selected = 0;
|
open_lmenu(Form.left+5 + image_menu_btn.x, Form.top+skin_height +
|
||||||
menu.show(Form.left+5 + image_menu_btn.x,
|
image_menu_btn.y + image_menu_btn.h, MENU_ALIGN_TOP_LEFT, NULL, #image_menu_items);
|
||||||
Form.top+skin_height + image_menu_btn.y + image_menu_btn.h,
|
|
||||||
240,
|
|
||||||
#image_menu_items,
|
|
||||||
20);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventCheckMenuItemSelected()
|
void EventCheckMenuItemSelected()
|
||||||
{
|
{
|
||||||
if (menu.cur_y) {
|
switch(get_menu_click()) {
|
||||||
if (20 == menu.cur_y) EventCountColorsUsed();
|
case 1:
|
||||||
if (21 == menu.cur_y) EventReplaceImageColors(color1, color2);
|
EventCountColorsUsed();
|
||||||
menu.cur_y = 0;
|
break;
|
||||||
|
case 2:
|
||||||
|
EventReplaceImageColors(color1, color2);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,7 +105,9 @@
|
|||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
menu_process_id = NULL;
|
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;
|
dword cd, in_len, out_len, new_buf;
|
||||||
|
|
||||||
|
from_chs = from_chs*10+#charsets;
|
||||||
|
|
||||||
debug("iconv: from_chs = "); debugln(from_chs);
|
debug("iconv: from_chs = "); debugln(from_chs);
|
||||||
debug("iconv: to_chs = "); debugln(to_chs);
|
debug("iconv: to_chs = "); debugln(to_chs);
|
||||||
|
|
||||||
|
@ -97,6 +97,8 @@ int encoding;
|
|||||||
dword bg_color;
|
dword bg_color;
|
||||||
dword text_color;
|
dword text_color;
|
||||||
|
|
||||||
|
dword menu_id;
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
// //
|
// //
|
||||||
// INTERNAL INCLUDES //
|
// INTERNAL INCLUDES //
|
||||||
@ -148,7 +150,7 @@ void main()
|
|||||||
HandleButtonEvent();
|
HandleButtonEvent();
|
||||||
break;
|
break;
|
||||||
case evReDraw:
|
case evReDraw:
|
||||||
EventMenuClick();
|
if (CheckActiveProcess(Form.ID)) EventMenuClick();
|
||||||
draw_window();
|
draw_window();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -295,22 +297,23 @@ void EventMagnifyMinus()
|
|||||||
|
|
||||||
void EventShowEncodingList()
|
void EventShowEncodingList()
|
||||||
{
|
{
|
||||||
menu.selected = encoding + 1;
|
open_lmenu(Form.left+5 + charsets_mx, Form.top+29+skin_height, MENU_ALIGN_TOP_LEFT, encoding+1,
|
||||||
menu.show(Form.left+5 + charsets_mx, Form.top+29+skin_height, 130,
|
"UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866");
|
||||||
"UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866", 10);
|
menu_id = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventShowReopenMenu()
|
void EventShowReopenMenu()
|
||||||
{
|
{
|
||||||
menu.selected = 0;
|
open_lmenu(Form.left+5 + reopenin_mx, Form.top+29+skin_height, MENU_ALIGN_TOP_LEFT, 0,
|
||||||
menu.show(Form.left+5 + reopenin_mx, Form.top+29+skin_height, 130,
|
"Tinypad\nTextEdit\nWebView\nFB2Read\nHexView\nOther");
|
||||||
"Tinypad\nTextEdit\nWebView\nFB2Read\nHexView\nOther", 20);
|
menu_id = 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventShowColorSchemesList()
|
void EventShowColorSchemesList()
|
||||||
{
|
{
|
||||||
menu.selected = curcol_scheme + 1;
|
open_lmenu(Form.left+5 + colscheme_mx, Form.top+29+skin_height, MENU_ALIGN_TOP_LEFT,
|
||||||
menu.show(Form.left+5 + colscheme_mx, Form.top+29+skin_height, 175, #color_scheme_names, 30);
|
curcol_scheme+1, #color_scheme_names);
|
||||||
|
menu_id = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EventSetColorScheme(dword _setn)
|
void EventSetColorScheme(dword _setn)
|
||||||
@ -343,11 +346,12 @@ void EventOpenFileInAnotherProgram(dword _app)
|
|||||||
void EventMenuClick()
|
void EventMenuClick()
|
||||||
{
|
{
|
||||||
byte open_param[4096];
|
byte open_param[4096];
|
||||||
switch(menu.cur_y)
|
dword click_id = get_menu_click();
|
||||||
|
if (click_id) switch(click_id + menu_id - 1)
|
||||||
{
|
{
|
||||||
//Encoding
|
//Encoding
|
||||||
case 10...15:
|
case 10...15:
|
||||||
EventChangeEncoding(menu.cur_y-10);
|
EventChangeEncoding(click_id-1);
|
||||||
break;
|
break;
|
||||||
//Reopen
|
//Reopen
|
||||||
case 20:
|
case 20:
|
||||||
@ -372,11 +376,10 @@ void EventMenuClick()
|
|||||||
break;
|
break;
|
||||||
//ColorSchemes
|
//ColorSchemes
|
||||||
case 30...38:
|
case 30...38:
|
||||||
EventSetColorScheme(menu.cur_y-30);
|
EventSetColorScheme(click_id-1);
|
||||||
PreparePage();
|
PreparePage();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
menu.cur_y = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//===================================================//
|
//===================================================//
|
||||||
@ -399,7 +402,7 @@ void OpenFile(dword f_path)
|
|||||||
io.buffer_data = INTRO_TEXT;
|
io.buffer_data = INTRO_TEXT;
|
||||||
strcpy(#title, "Text Reader");
|
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.KeyHome();
|
||||||
list.ClearList();
|
list.ClearList();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user