Ejemplo n.º 1
0
void BeyeContext::init_tconsole( unsigned long vio_flg,unsigned long twin_flg )
{
    beye_priv& priv = static_cast<beye_priv&>(opaque);
    priv._tconsole=twInit(system(),codepage,vio_flg,twin_flg);
    if(priv._tconsole->vio_width() < 80 || priv._tconsole->vio_height() < 3) {
	if(priv._tconsole->vio_width()>16 && priv._tconsole->vio_height()>2) {
	    unsigned evt,x,y;
	    TWindow *win;
	    x = (priv._tconsole->vio_width()-17)/2;
	    y = (priv._tconsole->vio_height()-3)/2;
	    win = new(zeromem) TWindow(x,y,x+16,y+2,TWindow::Flag_None | TWindow::Flag_NLS);
	    if(!win) goto done;
	    win->set_title(" Error ",TWindow::TMode_Center,error_cset.border);
	    win->into_center();
	    win->set_color(error_cset.main);
	    win->set_frame(TWindow::DOUBLE_FRAME,error_cset.border);
	    win->goto_xy(1,1);
	    win->puts("Screensize<80x3");
	    win->show();
	    do {
		evt = GetEvent(NULL,NULL,win);
	    }while(!(evt == KE_ESCAPE || evt == KE_F(10) || evt == KE_ENTER));
	    delete win;
	}
done:
	twDestroy();
	std::cerr<<"Current size of video buffer is: w="<<priv._tconsole->vio_width()<<" h="<<priv._tconsole->vio_height()<<std::endl;
	throw std::runtime_error("Size of video buffer must be larger than 79x2");
    }
}
Ejemplo n.º 2
0
void BeyeContext::show_usage() const {
    beye_priv& priv = static_cast<beye_priv&>(opaque);
    unsigned evt,i,nln,h,y;
    TWindow *win;
    nln = sizeof(beyeArg)/sizeof(struct tagbeyeArg);
    h = nln+4;
    y = priv._tconsole->vio_height()/2-h/2;
    win = new(zeromem) TWindow(2,y,priv._tconsole->vio_width()-2,h+2,TWindow::Flag_None | TWindow::Flag_NLS);

    win->set_title(BEYE_VER_MSG,TWindow::TMode_Center,error_cset.border);
    win->into_center();
    win->set_color(error_cset.main);
    win->set_frame(TWindow::DOUBLE_FRAME,error_cset.border);
    win->set_footer(" Press [ ESC ] to quit ",TWindow::TMode_Right,error_cset.border);
    win->clear();
    win->goto_xy(1,1);
    win->puts(" Usage: beye [OPTIONS] file...");
    for(i = 0;i < nln;i++)
    {
	win->goto_xy(1,4+i);
	win->printf("  %s     %s\n",beyeArg[i].key,beyeArg[i].prompt);
    }
    win->show();
    do {
	evt = GetEvent(NULL,NULL,priv.ErrorWnd);
    }while(!(evt == KE_ESCAPE || evt == KE_F(10) || evt == KE_ENTER));
    delete win;
}
Ejemplo n.º 3
0
TWindow * __FASTCALL__ CrtHlpWndnls(const std::string& title,tAbsCoord x2,tAbsCoord y2)
{
 TWindow *win;
 TWindow::twc_flag flags = TWindow::Flag_Has_Frame|TWindow::Flag_NLS;
 win = new(zeromem) TWindow(0,0,x2+2,y2+2,flags);
 win->into_center();
 win->set_color(help_cset.main);
 win->clear();
 win->set_frame(TWindow::DOUBLE_FRAME,help_cset.border);
 if(!title.empty()) win->set_title(title,TWindow::TMode_Center,help_cset.title);
 win->show();
 return win;
}
Ejemplo n.º 4
0
TWindow * __FASTCALL__ CrtDlgWndnls(const std::string& title,tAbsCoord width,tAbsCoord height )
{
 TWindow *win;
 TWindow::twc_flag flags;
 flags = TWindow::Flag_Has_Frame|TWindow::Flag_NLS;
 win = new(zeromem) TWindow(0,0,width+2,height+2,flags);
 win->into_center();
 win->set_color(dialog_cset.main);
 win->clear();
 win->set_frame(TWindow::DOUBLE_FRAME,dialog_cset.border);
 if(!title.empty()) win->set_title(title,TWindow::TMode_Center,dialog_cset.title);
 win->show();
 return win;
}