Ejemplo n.º 1
0
void
LoadLayout(struct layout *lay)
{
  AutosaveLayout(D_layout);
  if (!lay)
    {
      while (D_canvas.c_slperp)
	FreeCanvas(D_canvas.c_slperp);
      MakeDefaultCanvas();
      SetCanvasWindow(D_forecv, 0);
      D_layout = 0;
      return;
    }
  while (D_canvas.c_slperp)
    FreeCanvas(D_canvas.c_slperp);
  D_cvlist = 0;
  if (!D_forecv)
    MakeDefaultCanvas();
  D_forecv = lay->lay_forecv;
  if (!D_forecv)
    MakeDefaultCanvas();
  DupLayoutCv(&lay->lay_canvas, &D_canvas, 0);
  D_canvas.c_ys = (D_has_hstatus == HSTATUS_FIRSTLINE);
  D_canvas.c_ye = D_height - 1 - ((D_canvas.c_slperp && D_canvas.c_slperp->c_slnext) || captionalways) - (D_has_hstatus == HSTATUS_LASTLINE);
  ResizeCanvas(&D_canvas);
  RecreateCanvasChain();
  RethinkDisplayViewports();
  PutWindowCv(&D_canvas);
  ResizeLayersToCanvases();
  D_layout = lay;
}
Ejemplo n.º 2
0
void AutosaveLayout(Layout *lay)
{
	Canvas *fcv;
	if (!lay || !lay->lay_autosave)
		return;
	FreeLayoutCv(&lay->lay_canvas);
	fcv = D_forecv;
	DupLayoutCv(&D_canvas, &lay->lay_canvas, true);
	lay->lay_forecv = D_forecv;
	D_forecv = fcv;
}
Ejemplo n.º 3
0
void SaveLayout(char *name, Canvas *cv)
{
	Layout *lay;
	Canvas *fcv;
	for (lay = layouts; lay; lay = lay->lay_next)
		if (!strcmp(lay->lay_title, name))
			break;
	if (lay)
		FreeLayoutCv(&lay->lay_canvas);
	else
		lay = CreateLayout(name, 0);
	if (!lay)
		return;
	fcv = D_forecv;
	DupLayoutCv(cv, &lay->lay_canvas, true);
	lay->lay_forecv = D_forecv;
	D_forecv = fcv;
	D_layout = lay;
}
Ejemplo n.º 4
0
void NewLayout(char *title, int startat)
{
	Layout *lay;
	Canvas *fcv;

	lay = CreateLayout(title, startat);
	if (!lay)
		return;

	if (display) {
		LoadLayout(0);
		fcv = D_forecv;
		DupLayoutCv(&D_canvas, &lay->lay_canvas, true);
		lay->lay_forecv = D_forecv;
		D_forecv = fcv;
		D_layout = lay;
	} else {
		layout_attach = lay;
	}
	lay->lay_autosave = 1;
}
Ejemplo n.º 5
0
void DupLayoutCv(struct canvas *cvf, struct canvas *cvt, int save)
{
	while (cvf) {
		cvt->c_slorient = cvf->c_slorient;
		cvt->c_slweight = cvf->c_slweight;
		if (cvf == D_forecv)
			D_forecv = cvt;
		if (!save) {
			cvt->c_display = display;
			if (!cvf->c_slperp) {
				cvt->c_captev.type = EV_TIMEOUT;
				cvt->c_captev.data = (char *)cvt;
				cvt->c_captev.handler = NULL;
				cvt->c_blank.l_cvlist = 0;
				cvt->c_blank.l_layfn = &BlankLf;
				cvt->c_blank.l_bottom = &cvt->c_blank;
			}
			cvt->c_layer = cvf->c_layer;
		} else {
			struct win *p = cvf->c_layer ? Layer2Window(cvf->c_layer) : 0;
			cvt->c_layer = p ? &p->w_layer : 0;
		}
		if (cvf->c_slperp) {
			cvt->c_slperp = calloc(1, sizeof(struct canvas));
			cvt->c_slperp->c_slback = cvt;
			CanvasInitBlank(cvt->c_slperp);
			DupLayoutCv(cvf->c_slperp, cvt->c_slperp, save);
		}
		if (cvf->c_slnext) {
			cvt->c_slnext = calloc(1, sizeof(struct canvas));
			cvt->c_slnext->c_slprev = cvt;
			cvt->c_slnext->c_slback = cvt->c_slback;
			CanvasInitBlank(cvt->c_slnext);
		}
		cvf = cvf->c_slnext;
		cvt = cvt->c_slnext;
	}
}