Exemple #1
0
int Text::gtwidth()
{
    if(xpos== -1)
    {
        if(!ckw())
            if(text)
                stwidth(txtw(gtfgnd(),text) + txtw(gtfgnd(),"M"));
            else
                stwidth(64);
        if(text)
            xpos=Lith::gtwidth() / 2 - txtw(gtfgnd(), text) / 2;
        else
            xpos=txtw(gtfgnd(),"M") / 2;
    }
    return Lith::gtwidth();
}
Exemple #2
0
void Field::st(String val)
  {
  buf=val;
  if(!ckw()) stwidth(buf.size()+1);
  if(!ckh()) stheight(txth(gtfgnd()));
  cursor=buf.size();
  repos();
  }
Exemple #3
0
int main(int argc, char *argv[])
{
	float width = 1.0f;
	int i;

	for (i = 1; i < argc; i++)
	{
		if (!strcmp(argv[i], "-width") && i+1 < argc)
			width = atof(argv[++i]);
		else if (!strcmp(argv[i], "-help"))
		{
			fprintf(stderr, "options: -width width "
				"(1.0 = no change, 0.0 = mono)\n");
			exit(0);
		}
	}

	SET_BINARY_MODE
	stwidth(width);
	return 0;
}
Exemple #4
0
Edit::Edit()
  {

  if(!edit_kmap)
    {
    edit_kmap=new Kmap< void (Widget::*)(int) >(screen.scrn);
    edit_kmap->merge(*screen.gtstdkmap());
    edit_kmap->add("^A",(void (Widget::*)(int))&Edit::bol);
    edit_kmap->add(".kh",(void (Widget::*)(int))&Edit::bol);
    edit_kmap->add("^E",(void (Widget::*)(int))&Edit::eol);
    edit_kmap->add(".kH",(void (Widget::*)(int))&Edit::eol);
    edit_kmap->add("^F",(void (Widget::*)(int))&Edit::rtarw);
    edit_kmap->add(".kr",(void (Widget::*)(int))&Edit::rtarw);
    edit_kmap->add("^B",(void (Widget::*)(int))&Edit::ltarw);
    edit_kmap->add(".kl",(void (Widget::*)(int))&Edit::ltarw);
    edit_kmap->add("^P",(void (Widget::*)(int))&Edit::uparw);
    edit_kmap->add(".ku",(void (Widget::*)(int))&Edit::uparw);
    edit_kmap->add("^N",(void (Widget::*)(int))&Edit::dnarw);
    edit_kmap->add(".kd",(void (Widget::*)(int))&Edit::dnarw);
    edit_kmap->add("^Y",(void (Widget::*)(int))&Edit::dellin);
    edit_kmap->add("^D",(void (Widget::*)(int))&Edit::delch);
    edit_kmap->add(".kD",(void (Widget::*)(int))&Edit::delch);
    edit_kmap->add("^H",(void (Widget::*)(int))&Edit::backs);
    edit_kmap->add("^?",(void (Widget::*)(int))&Edit::backs);
    edit_kmap->add("^M",(void (Widget::*)(int))&Edit::rtn);
    edit_kmap->add("sp TO ~",(void (Widget::*)(int))&Edit::type);
    }

  stheight(txth(gtfgnd())*8);
  stwidth(txtw(gtfgnd(),"M")*32);
  stkmap(edit_kmap);
  cursor=buf.bof->clone();
  top=buf.bof->clone();
  loffset=0;
  stbknd('_');
  focusable();
  }