textreader: remove internal menu.h, use lib/menu.h

git-svn-id: svn://kolibrios.org@6042 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-01-07 15:43:03 +00:00
parent d1ac782f6d
commit 4f91b51e53
2 changed files with 5 additions and 67 deletions

View File

@ -1,63 +0,0 @@
char stak[4096];
byte action_buf;
llist menu;
void menu_rmb()
{
proc_info MenuForm;
menu.ClearList();
while (charsets[menu.count]) menu.count++;
menu.SetSizes(2,2,140,menu.count*19,19);
SetEventMask(100111b);
_BEGIN_APPLICATION_MENU:
switch(WaitEvent())
{
case evMouse:
GetProcessInfo(#MenuForm, SelfInfo);
if (!CheckActiveProcess(MenuForm.ID)) ExitProcess();
mouse.get();
if (menu.ProcessMouse(mouse.x, mouse.y)) DrawMenuList();
if (mouse.lkm)&&(mouse.up) ItemClick();
break;
case evKey:
GetKeys();
if (key_scancode==SCAN_CODE_ESC) ExitProcess();
if (key_scancode==SCAN_CODE_ENTER) ItemClick();
if (menu.ProcessKey(key_scancode)) DrawMenuList();
break;
case evReDraw:
DefineAndDrawWindow(Form.left+104,Form.top+29+SKIN.height,menu.w+2,menu.h+4,0x01, 0, 0, 0x01fffFFF);
DrawPopup(0,0,menu.w,menu.h+3,0, 0xE4DFE1,0x9098B0);
DrawMenuList();
}
goto _BEGIN_APPLICATION_MENU;
}
void DrawMenuList()
{
int N;
for (N=0; N<menu.count; N++;)
{
if (N==menu.cur_y)
DrawBar(menu.x, N*menu.item_h+menu.y, menu.w-3, menu.item_h, 0xFFFfff);
else
{
DrawBar(menu.x, N*menu.item_h+menu.y, menu.w-3, menu.item_h, 0xE4DFE1);
WriteText(19,N*menu.item_h+9,0x80,0xf2f2f2,charsets[N]);
}
WriteText(18,N*menu.item_h+8,0x80,0x000000,charsets[N]);
}
WriteText(5, encoding*menu.item_h+7, 0x80, 0x777777, "\x10");
}
void ItemClick()
{
if (encoding!=menu.cur_y)
{
encoding = menu.cur_y;
action_buf = true;
}
ExitProcess();
}

View File

@ -4,6 +4,7 @@
#include "../lib/io.h" #include "../lib/io.h"
#include "../lib/gui.h" #include "../lib/gui.h"
#include "../lib/list_box.h" #include "../lib/list_box.h"
#include "../lib/menu.h"
#include "../lib/obj/box_lib.h" #include "../lib/obj/box_lib.h"
#include "../lib/obj/libini.h" #include "../lib/obj/libini.h"
#include "../lib/obj/iconv.h" #include "../lib/obj/iconv.h"
@ -52,7 +53,6 @@ enum {
}; };
#include "ini.h" #include "ini.h"
#include "menu.h"
#include "gui.h" #include "gui.h"
#include "prepare_page.h" #include "prepare_page.h"
@ -92,10 +92,10 @@ void main()
HandleButtonEvent(); HandleButtonEvent();
break; break;
case evReDraw: case evReDraw:
if (action_buf) { if (menu.list.cur_y) {
encoding = menu.list.cur_y - 10;
OpenFile(#param); OpenFile(#param);
PreparePage(); PreparePage();
action_buf = false;
}; };
draw_window(); draw_window();
} }
@ -224,7 +224,8 @@ void EventRunEdit()
void EventChangeEncoding() void EventChangeEncoding()
{ {
CreateThread(#menu_rmb,#stak+4092); menu.selected = encoding + 1;
menu.show(Form.left+104, Form.top+29+skin_height, 130, "UTF-8\nKOI8-RU\nCP1251\nCP1252\nISO8859-5\nCP866", 10);
} }
void EventShowInfo() { void EventShowInfo() {