mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-26 14:15:32 +00:00
Alains patch for setting tabular column global settings.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5217 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
f75f152e5b
commit
1c090286fe
@ -1,3 +1,13 @@
|
||||
2002-09-06 Alain Castera <castera@in2p3.fr>
|
||||
|
||||
* tabular.C: uses \tabularnewline; uses >{...} construct from array
|
||||
package to set the horizontal alignment on fixed width columns.
|
||||
|
||||
* lyx_sty.C:
|
||||
* lyx_sty.h: added tabularnewline macro def.
|
||||
|
||||
* LaTeXFeatures.C: added NeedTabularnewline macro feature
|
||||
|
||||
2002-09-06 John Levon <levon@movementarian.org>
|
||||
|
||||
* LyXAction.C: tooltips for sub/superscript
|
||||
|
@ -339,6 +339,10 @@ string const LaTeXFeatures::getMacros() const
|
||||
if (isRequired("NeedLyXFootnoteCode"))
|
||||
macros << floatingfootnote_def;
|
||||
|
||||
// some problems with tex->html converters
|
||||
if (isRequired("NeedTabularnewline"))
|
||||
macros << tabularnewline_def;
|
||||
|
||||
// floats
|
||||
getFloatDefinitions(macros);
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2002-09-06 Alain Castera <castera@in2p3.fr>
|
||||
|
||||
* FormTabular.C: leave the horizontal alignment buttons alive
|
||||
on fixed width columns
|
||||
|
||||
2002-09-05 Angus Leeming <leeming@lyx.org>
|
||||
|
||||
* all files: modify the headers as discussed on the list.
|
||||
|
@ -222,7 +222,7 @@ void FormTabular::update()
|
||||
}
|
||||
pwidth = tabular->GetMColumnPWidth(cell);
|
||||
align = tabular->GetAlignment(cell);
|
||||
if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
|
||||
if (align == LYX_ALIGN_LEFT)
|
||||
fl_set_button(cell_options_->radio_align_left, 1);
|
||||
else if (align == LYX_ALIGN_RIGHT)
|
||||
fl_set_button(cell_options_->radio_align_right, 1);
|
||||
@ -258,9 +258,9 @@ void FormTabular::update()
|
||||
setEnabled(cell_options_->radio_valign_bottom, !pwidth.zero());
|
||||
setEnabled(cell_options_->radio_valign_center, !pwidth.zero());
|
||||
|
||||
setEnabled(cell_options_->radio_align_left, pwidth.zero());
|
||||
setEnabled(cell_options_->radio_align_right, pwidth.zero());
|
||||
setEnabled(cell_options_->radio_align_center, pwidth.zero());
|
||||
setEnabled(cell_options_->radio_align_left, true);
|
||||
setEnabled(cell_options_->radio_align_right, true);
|
||||
setEnabled(cell_options_->radio_align_center, true);
|
||||
} else {
|
||||
fl_set_button(cell_options_->check_multicolumn, 0);
|
||||
|
||||
@ -349,7 +349,7 @@ void FormTabular::update()
|
||||
fl_set_button(column_options_->radio_align_left, 0);
|
||||
fl_set_button(column_options_->radio_align_right, 0);
|
||||
fl_set_button(column_options_->radio_align_center, 0);
|
||||
if (!pwidth.zero() || (align == LYX_ALIGN_LEFT))
|
||||
if (align == LYX_ALIGN_LEFT)
|
||||
fl_set_button(column_options_->radio_align_left, 1);
|
||||
else if (align == LYX_ALIGN_RIGHT)
|
||||
fl_set_button(column_options_->radio_align_right, 1);
|
||||
@ -366,10 +366,9 @@ void FormTabular::update()
|
||||
else
|
||||
fl_set_button(column_options_->radio_valign_top, 1);
|
||||
|
||||
setEnabled(column_options_->radio_align_left, pwidth.zero());
|
||||
setEnabled(column_options_->radio_align_right, pwidth.zero());
|
||||
setEnabled(column_options_->radio_align_center, pwidth.zero());
|
||||
|
||||
setEnabled(column_options_->radio_align_left, true);
|
||||
setEnabled(column_options_->radio_align_right, true);
|
||||
setEnabled(column_options_->radio_align_center, true);
|
||||
setEnabled(column_options_->radio_valign_top, !pwidth.zero());
|
||||
setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
|
||||
setEnabled(column_options_->radio_valign_center, !pwidth.zero());
|
||||
|
@ -118,3 +118,7 @@ string const binom_def =
|
||||
string const mathcircumflex_def =
|
||||
"%% For printing a cirumflex inside a formula\n"
|
||||
"\\newcommand{\\mathcircumflex}[0]{\\mbox{\\^{}}}\n";
|
||||
|
||||
string const tabularnewline_def =
|
||||
"%% Because html converters don't know tabularnewline\n"
|
||||
"\\providecommand{\\tabularnewline}{\\\\}\n";
|
||||
|
@ -49,5 +49,7 @@ extern string const boldsymbol_def;
|
||||
extern string const binom_def;
|
||||
///
|
||||
extern string const mathcircumflex_def;
|
||||
///
|
||||
extern string const tabularnewline_def;
|
||||
|
||||
#endif // LYX_STY_H
|
||||
|
@ -751,8 +751,9 @@ bool LyXTabular::SetColumnPWidth(int cell, LyXLength const & width)
|
||||
int const j = column_of_cell(cell);
|
||||
|
||||
column_info[j].p_width = width;
|
||||
if (flag) // do this only if there is a width
|
||||
SetAlignment(cell, LYX_ALIGN_LEFT);
|
||||
// This should not ne necessary anymore
|
||||
// if (flag) // do this only if there is a width
|
||||
// SetAlignment(cell, LYX_ALIGN_LEFT);
|
||||
for (int i = 0; i < rows_; ++i) {
|
||||
int c = GetCellNumber(i, j);
|
||||
flag = !GetPWidth(c).zero(); // because of multicolumns!
|
||||
@ -2212,7 +2213,7 @@ int LyXTabular::TeXRow(ostream & os, int const i, Buffer const * buf,
|
||||
}
|
||||
++cell;
|
||||
}
|
||||
os << "\\\\\n";
|
||||
os << "\\tabularnewline\n";
|
||||
++ret;
|
||||
ret += TeXBottomHLine(os, i);
|
||||
return ret;
|
||||
@ -2243,6 +2244,20 @@ int LyXTabular::latex(Buffer const * buf,
|
||||
if (column_info[i].left_line)
|
||||
os << '|';
|
||||
if (!column_info[i].p_width.zero()) {
|
||||
os << ">{";
|
||||
switch (column_info[i].alignment) {
|
||||
case LYX_ALIGN_LEFT:
|
||||
os << "\\raggedright";
|
||||
break;
|
||||
case LYX_ALIGN_RIGHT:
|
||||
os << "\\raggedleft";
|
||||
break;
|
||||
case LYX_ALIGN_CENTER:
|
||||
os << "\\centering";
|
||||
break;
|
||||
}
|
||||
os << "}";
|
||||
|
||||
switch (column_info[i].valignment) {
|
||||
case LYX_VALIGN_TOP:
|
||||
os << "p";
|
||||
@ -2722,12 +2737,15 @@ int LyXTabular::GetCellFromInset(Inset const * inset, int maybe_cell) const
|
||||
|
||||
void LyXTabular::Validate(LaTeXFeatures & features) const
|
||||
{
|
||||
features.require("NeedTabularnewline");
|
||||
if (IsLongTabular())
|
||||
features.require("longtable");
|
||||
if (NeedRotating())
|
||||
features.require("rotating");
|
||||
for (int cell = 0; cell < numberofcells; ++cell) {
|
||||
if (GetVAlignment(cell) != LYX_VALIGN_TOP)
|
||||
if ( (GetVAlignment(cell) != LYX_VALIGN_TOP) ||
|
||||
( !(GetPWidth(cell).zero())&&!(IsMultiColumn(cell)) )
|
||||
)
|
||||
features.require("array");
|
||||
GetCellInset(cell)->validate(features);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user