コード例 #1
0
ファイル: table.c プロジェクト: SWI-Prolog/packages-xpce
static status
appendTable(Table tab, TableCell cell, Int x, Int y)
{ int cspan = valInt(cell->col_span);
  int rspan = valInt(cell->row_span);
  int dy;

  if ( isDefault(x) )
    x = tab->current->x;
  if ( isDefault(y) )
    y = tab->current->y;

  if ( notNil(tab->device) && notNil(cell->image) )
    send(tab->device, NAME_display, cell->image, EAV);

  assign(cell, layout_manager, tab);
  assign(cell, column, x);
  assign(cell, row, y);

  for(dy=0; dy<rspan; dy++)
  { Int cy = toInt(valInt(y)+dy);
    TableRow row = getRowTable(tab, cy, ON);
    int dx;

    for(dx=0; dx<cspan; dx++)
    { Int cx = toInt(valInt(x)+dx);

      cellTableRow(row, cx, cell);
    }
  }

  advance_table(tab);
  requestComputeLayoutManager((LayoutManager)tab, DEFAULT);

  return changedTable(tab);
}
コード例 #2
0
ファイル: table.c プロジェクト: SWI-Prolog/packages-xpce
static status
deleteCellTable(Table tab, TableCell cell, BoolObj keep)
{ if ( cell->layout_manager == (LayoutManager)tab )
  { int tx = valInt(cell->column) + valInt(cell->col_span);
    int ty = valInt(cell->row) + valInt(cell->row_span);
    int x, y;

    removeCellImageTable(tab, cell, keep);

    for(y=valInt(cell->row); y<ty; y++)
    { TableRow row = getRowTable(tab, toInt(y), OFF);

      if ( row )
      { for(x=valInt(cell->column); x<tx; x++)
	  elementVector((Vector)row, toInt(x), NIL);
      }
    }

    assign(cell, layout_manager, NIL);

    changedTable(tab);
    requestComputeLayoutManager((LayoutManager)tab, DEFAULT);
  }

  succeed;
}
コード例 #3
0
ファイル: tabcell.c プロジェクト: brayc0/nlfetdb
void
dims_table_cell(TableCell cell, TableCellDimensions dims)
{ int w=0, h=0;
  TableRow row;
  TableColumn col;
  int cx, cy;
  int ncols = valInt(cell->col_span);
  int nrows = valInt(cell->row_span);
  int n;
  Table tab = table_of_cell(cell);
  int x = valInt(cell->column);
  int y = valInt(cell->row);

  table_cell_padding(cell, &dims->px, &dims->py);

  row = getRowTable(tab,    cell->row, ON); /* play safe */
  col = getColumnTable(tab, cell->column, ON);

  dims->x  = valInt(col->position);
  dims->y  = valInt(row->position);
  dims->rx = valInt(col->reference);
  dims->ry = valInt(row->reference);

  w        = valInt(col->width);
  h	   = valInt(row->width);

  if ( ncols > 1 || nrows > 1 )
  { int rowspace = valInt(tab->cell_spacing->h);
    int colspace = valInt(tab->cell_spacing->w);
					/* cells spanned */

    for(n=1, cx=x+1; n<ncols; n++, cx++)
      w += colspace+valInt(getColumnTable(tab, toInt(cx), ON)->width);
    for(n=1, cy=y+1; n<nrows; n++, cy++)
      h += rowspace+valInt(getRowTable(tab, toInt(cy), ON)->width);
  }

  dims->w = w;
  dims->h = h;
}
コード例 #4
0
ファイル: table.c プロジェクト: SWI-Prolog/packages-xpce
static void
advance_table(Table tab)
{ Point c = tab->current;
  TableRow row = getRowTable(tab, c->y, ON);

  if ( row )
  { int cx = valInt(c->x);

    while( getCellTableRow(row, toInt(cx)) )
      cx++;

    assign(c, x, toInt(cx));
  }
}
コード例 #5
0
ファイル: table.c プロジェクト: SWI-Prolog/packages-xpce
static status
nextRowTable(Table tab, BoolObj end_group)
{ if ( end_group == ON )
  { TableRow r = getRowTable(tab, tab->current->y, ON);

    send(r, NAME_endGroup, ON, EAV);
  }

  assign(tab->current, x, ONE);
  assign(tab->current, y, add(tab->current->y, ONE));
  advance_table(tab);

  succeed;
}
コード例 #6
0
ファイル: tabcell.c プロジェクト: brayc0/nlfetdb
Name
getValignTableCell(TableCell cell)
{ Table tab;

  if ( notDefault(cell->valign) )
    answer(cell->valign);

  if ( (tab=table_of_cell(cell)) && notNil(tab->rows) )
  { TableRow row = getRowTable(tab, cell->row, OFF);

    if ( row )
      answer(row->alignment);
  }

  answer(NAME_top);
}
コード例 #7
0
ファイル: table.c プロジェクト: SWI-Prolog/packages-xpce
static TableCell
getCellTable(Table tab, Any x, Any y)
{ TableRow row = getRowTable(tab, y, OFF);

  if ( row && notNil(row) )
  { TableCell cell = NULL;

    if ( isInteger(x) )
    { cell = getElementVector((Vector)row, x);
    } else
    { TableColumn col = getColumnTable(tab, x, OFF);
      if ( col )
	cell = getElementVector((Vector)row, col->index);
    }

    if ( cell && notNil(cell) )
      answer(cell);
  }

  fail;
}
コード例 #8
0
ファイル: tabcell.c プロジェクト: brayc0/nlfetdb
static status
rowSpanTableCell(TableCell cell, Int span)
{ if ( cell->row_span != span )
  { Table tab = table_of_cell(cell);

    if ( tab )
    { int x,y;
      int fy = valInt(cell->row);
      int h  = valInt(span);
      int oh = valInt(cell->row_span);
      int ty = max(h,oh)+fy;

      for(y=fy+1; y<ty; y++)
      { TableRow row = getRowTable(tab, toInt(y), ON);

	for(x=valInt(cell->column); x<valInt(cell->column)+valInt(cell->col_span); x++)
	{ Any e;

	  if ( y-fy < h )
	    e = cell;
	  else
	    e = NIL;

	  cellTableRow(row, toInt(x), e);
	}
      }

      assign(cell, row_span, span);
      changedTable(tab);		/* changed line-pattern */
      requestComputeLayoutManager((LayoutManager)tab, DEFAULT);
    } else
    { assign(cell, row_span, span);
    }
  }

  succeed;
}
コード例 #9
0
ファイル: tabcell.c プロジェクト: brayc0/nlfetdb
static status
colSpanTableCell(TableCell cell, Int span)
{ if ( cell->col_span != span )
  { Table tab = table_of_cell(cell);

    if ( tab )
    { int x,y;
      int fx = valInt(cell->column);
      int w  = valInt(span);
      int ow = valInt(cell->col_span);
      int tx = max(w,ow)+fx;

      for(y=valInt(cell->row); y<valInt(cell->row)+valInt(cell->row_span); y++)
      { TableRow row = getRowTable(tab, toInt(y), ON);

	for(x=fx+1; x<tx; x++)
	{ Any e;

	  if ( x-fx < w )
	    e = cell;
	  else
	    e = NIL;

	  cellTableRow(row, toInt(x), e);
	}
      }

      assign(cell, col_span, span);
      changedTable(tab);		/* changed line-pattern */
      requestComputeLayoutManager((LayoutManager)tab, DEFAULT);
    } else
    { assign(cell, col_span, span);
    }
  }

  succeed;
}