Jürgen Vigna wrote:
> Anyway I don't really grap what you mean.

Ok, let's try in english ;-) :

In a tabular column, the alignment of a paragraph may be given either by
the "context" (i.e., the setting of the column alignment params, tabular
popup) or the setting of the paragraph itself (paragraph popup). I wonder
if this can occur in another context, but forget it for the time being and
stay with tabular.

Up to now, LyX seemed to consider that "block" alignment in the
paragraph popup meaned "default", i.e. no LateX output formating, which
leaded to justified paragraphs most of the time, but either left, center
or right alignment in a tabular cell.

The patch which initated this thread introduced the possibility to have
justified paragraphs in a tabular cell (note : there is a little er..
glitch in this patch, see the note at the very end of this mail :).

So my second question was : shouldn't we now make the difference between
"default" alignment, i.e. given by the context, and explicitely required
justified text ? this means adding a variable in parameterStruct and a
button on paragraph popup, see below too.

My first question was : Can we force a text to be justified in ,e.g., a
tabular cell? The answer is obviously : yes as long as we can know the
width of the cell, by using a parbox. But is it always safe, or
appropriate ? I guess yes, but I am not sure.



Let me propose an implementation (a bad one, of course, but that's the
one I am testing now), I hope this may help a little bit.

        - In ParameterStruct, I added a variable
        LYX_ALIGN contextAlign;
with the corresponding methods. When contextAlign is set to
block,left,etc.., the "old" variable align is set accordingly.

        - In tabular, each cell inset is initialized with contextAlign =
cell->column->align.

        - In the paragraph popup, I added a button "AlignDefault", which
is set if contextAlign is something in block, left, center, right, unset
otherwise (i.e. layout, special,none). If you unset this button,
contextAlign takes the value LYX_ALIGN_NONE and the "old" radio-button
group is enabled to manually choose the alignment.


The display is done as before, but TeXRowOnePar output alignment commands
only if contextAlign is LYX_ALIGN_NONE, SPECIAL or LAYOUT (not really
consistent, I agree, but I didn't check really what NONE, SPECIAL and
LAYOUT were used for).

In other words, setting contextAlign to a given mode means that the
paragraph use "default" alignment (and no special TeX output), otherwise
the paragrapg parameters give the alignment.

To obtain a wysiwym display of fixed width tabular cells insets, just let
the insettext do the job. To obtain a justified text in a cell, we still
need to implement the appropropriate parbox command.
I wonder if such a mechanism could be used elsewhere, as the distinction
between "block" and "default" should be usefull everytime the LaTeX
environment implies some non justified alignment.

Unless somebody points me to a better method, I will go on this way as it
seems to me that it is the simplest way to obtain wysiwym display of fixed
width columns in a tabular. When it will be possible to test it, it will
still be time to discard everything ;-)

Alain


Note : the patch force column alignment to switch to "block" anytime you
enter the InsetTabular::tabularFeatures function with argument feature ==
SET_PWIDTH. The corresponding line of code should be deleted, or at least
executed only if tmplen.zero().


-- 
 *******************************************************************
 *        Alain Castera                                            *
 * IPNL - UCB Lyon 1             | e-mail : [EMAIL PROTECTED] *
 * Bat. Paul Dirac               |      or        [EMAIL PROTECTED] *
 * Campus de la Doua             | Telephone :     (+33) 472448429 *
 * F69622 Villeurbanne CEDEX     | Fax :           (+33) 472448004 *
 *******************************************************************

Reply via email to