Beispiel #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");
    }
}
Beispiel #2
0
TWindow *__FASTCALL__ PleaseWaitWnd()
{
   TWindow *w;
   w = CrtDlgWndnls(SYSTEM_BUSY,14,1);
   w->goto_xy(1,1); w->puts(PLEASE_WAIT);
   return w;
}
Beispiel #3
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;
}