On Mon, Aug 20, 2007 at 04:44:16PM +0200, Leuven, E. wrote:
> hi guys,
> 
> i made a start with ripping out the way merged cells are handled in
> the tabular code.
> 
> atm cells can have attributes
> 
> CELL_NORMAL CELL_BEGIN_OF_MULTICOLUMN CELL_PART_OF_MULTICOLUMN
> 
> if a range of cells is merged the first cell gets the
> CELL_BEGIN_OF_MULTICOLUMN attribute and the rest
> CELL_PART_OF_MULTICOLUMN. 
> 
> so we keep a range of cells for a single merged cell. there is a lot
> of bookkeeping necessary to keep things consistent.
> 
> i basically got rid of this so that we have one cell per cell. in the
> cell we have the attribute column_span which tells us how many columns
> the cell spans.
> 
> since this stuff is all over the place the attached patch is not
> exactly tiny or clean.
> 
> it is not finished yet, but most things should be ok.
> 
> since this tabular stuff is such a mess and tricky i'd like to ask for
> some input. 
> 
> basically: is this the way to go?

If you have the feeling that things are simpler/less-of-a-mess
afterwards, then it doesn't sound wrong.
 
> (i also touched the metrics and drawing stuff, so perhaps a
> knowledgeable person could have a peek?)
> 
> thanks, edwin.
 

Content-Description: tab1.diff
> Index: src/frontends/controllers/ControlTabular.cpp
> ===================================================================
> --- src/frontends/controllers/ControlTabular.cpp      (revision 19656)
> +++ src/frontends/controllers/ControlTabular.cpp      (working copy)
> @@ -92,7 +92,7 @@
>  
>  void ControlTabular::toggleTopLine()
>  {
> -     if (tabular().isMultiColumn(getActiveCell()))
> +     if (tabular().cell_info[getActiveCell()].multicolumn)

Why no keep the accessor method?

>  Tabular::cellstruct::cellstruct(BufferParams const & bp)
> -     : cellno(0),
> -       width_of_cell(0),
> -       multicolumn(Tabular::CELL_NORMAL),
> +     : width_(0),
> +       multicolumn(false),
> +       column_span(1),
>         alignment(LYX_ALIGN_CENTER),
>         valignment(LYX_VALIGN_TOP),
> -       top_line(true),
> +       top_line(false),
>         bottom_line(false),
> -       left_line(true),
> +       left_line(false),
>         right_line(false),
>         usebox(BOX_NONE),
>         rotate(false),

This seems to change behaviour.

Would your approach also allow for cells spanning multiple rows in the
long run?

Wrt the metrics/drawing: To big to make an educated guess whether it
still works as before. So if it works, it works. Make sure you test with
a variety of multicol cells.

Andre'

Reply via email to