|
//
//
//
#include
#include "menu.h"
#include "main.h"
//
//
//
WINDOW *MainWindow;
unsigned char KeyPressed;
int XPos = 1, YPos = 1;
extern unsigned char DataArray[20*80];
extern void (*ActionFunction)();
//
//
//
void DoEdit()
{
MainWindow->_cury = YPos;
MainWindow->_curx = XPos;
box(MainWindow,ACS_VLINE,ACS_HLINE);
wnoutrefresh(MainWindow);
doupdate();
curs_set(1);
while(1)
{
KeyPressed = getch();
if(KeyPressed == 27)
{
ActionFunction = DoMenu;
break; // ESC was pressed
}
else
switch(KeyPressed)
{
case(10):
{
if(YPos < MainWindow->_maxy - 1)
{
XPos = MainWindow->_begx + 1;
YPos++;
};
break;
};
default:
{
DataArray[EDIT_WIDTH * (YPos-1) + (XPos-1)] = KeyPressed;
mvwaddch(MainWindow, YPos, XPos, KeyPressed);
if(++XPos == MainWindow->_maxx - 1)
{
XPos = MainWindow->_begx + 1;
if(YPos < MainWindow->_maxy - 1)YPos++;
}
break;
};
}
MainWindow->_cury = YPos;
MainWindow->_curx = XPos;
wnoutrefresh(MainWindow);
doupdate();
}
}
E-mail: info@telesys.ru