Hi. Seasons Greatings to all of you.

I finally got some time to work on the display of tabular, and in the
meanwhile found some inconsistencies in the code with regards to the
management of the alignment.

Unfortunately, the version I've now, based on 1.3.0pre1, includes both
topics so it would imply some extra work (including tests) to submit
separate patches. Thus I would prefer to collect comments (and insults too
;-) before sending it all at once or in separate parts (lazzy boy).

Alignment 1 : in the present code, a paragraph with "default alignment"
may be indicated (params()->align) as LYX_ALIGN_LAYOUT or LYX_ALIGN_BLOCK
(as the LaTeX output for LYX_ALIGN_BLOCK is ... nothing). Furthermore, a
paragraph set to LYX_ALIGN_LAYOUT will be reset to the actual value of
the layout alignment IF YOU CALL the paragrah Dialog!!! It is working,
though potentially adding unnecessary commands in the latex output, but
this is closer to a word processor approach than to the LaTeX
philosophy;-)
It would be more clear to know if the paragraph follows the default (I
kept LYX_ALIGN_LAYOUT for this) or is forced to a given alignment
(including justified by use of LYX_ALIGN_BLOCK). So I changed the
paragraph dialog (in xforms only) to had a "default" button in the
alignment section. When set, the paraghraph follows the default and the
usual alignment buttons are disabled.
In LaTeX output, nothing is added if the paragraph follows the default
(avoiding redondant successive commands), otherwise the proper command is
emited (huh, I didn't code for a forced justified paragraph yet, one
still have to use a parbox or a minipage).

Alignment 2 : it appears from time to time (well, I found it in tabular
cells but it could occur in other context) that the default alignment is
given by something else than the layout. As it wasn't pertinent (and may
be dangerous) to create a new layout everytime one encounter this case, I
added a field to the parameter struct : defaultAlignment. The handling
mechanism is simple :
        - if (align != LYX_ALIGN_LAYOUT) align gives the alignment
        - else if (defaultAlignment != ..LAYOUT), defaultAlignment is
taken
        - else alignment is given by the layout.
I added/modified access functions accordingly in ParagraphParameter (and
added most of them in Paragraph too to allow a cleaner code than the
actual).

Tabular 3 : Tabular was modified to use this new field (fixed width column
only for the time being) and it works rather well, giving a wysiwym
display of these columns without changing the latex output :-)


If these modifications present some interest, we can clean the code
further : change some variable names (align in the parameter field could
be alignMode, LYX_ALIGN_LAYOUT could be LYX_ALIGN_DEFAULT, new access
functions in Paragraph could be used almost everywhere instead of
par->params()->align construct which break the encapsulation, and so on).
What is missing is handling "forced" justified paragraph in the latex
output (I think I could), adapting docbook output (don't know, is it
easy?), adapting qt paragraph dialog (help welcome).


As usual, I am sure than I am not clear (I really should try to speak
english). But anyway, may be somebody will understand at least enough to
ask for some explanations.

Have fun.
Alain

-- 
 *******************************************************************
 *        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