]> git.lyx.org Git - lyx.git/commitdiff
Alains patch for setting tabular column global settings.
authorJürgen Vigna <jug@sad.it>
Fri, 6 Sep 2002 13:41:19 +0000 (13:41 +0000)
committerJürgen Vigna <jug@sad.it>
Fri, 6 Sep 2002 13:41:19 +0000 (13:41 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5217 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/LaTeXFeatures.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormTabular.C
src/lyx_sty.C
src/lyx_sty.h
src/tabular.C

index 5e2b7501c751b1d800b4f460ef1187c53032d51e..cd01d69670def8c3a97386e0baaa4b0aedbf21b0 100644 (file)
@@ -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
 2002-09-06  John Levon  <levon@movementarian.org>
 
        * LyXAction.C: tooltips for sub/superscript
index 7174eb91c86d7566456b86ad3ce281ea3fe6bdc1..6bc5141f2ab36c8ada838c78a946bd30da5afec6 100644 (file)
@@ -339,6 +339,10 @@ string const LaTeXFeatures::getMacros() const
        if (isRequired("NeedLyXFootnoteCode"))
                macros << floatingfootnote_def;
 
        if (isRequired("NeedLyXFootnoteCode"))
                macros << floatingfootnote_def;
 
+       // some problems with tex->html converters
+       if (isRequired("NeedTabularnewline"))
+               macros << tabularnewline_def;
+
        // floats
        getFloatDefinitions(macros);
 
        // floats
        getFloatDefinitions(macros);
 
index 7c2c76e5cca5ea8622037ca93f71510371073823..28db42fd8a82c21138b798e5224fe642efd980fd 100644 (file)
@@ -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.
 2002-09-05  Angus Leeming  <leeming@lyx.org>
 
        * all files: modify the headers as discussed on the list.
index 21d1f4912c6b6727c4fb5e4f7fac3c3661730db4..2056abebacafcd45f70212740b70d2aa6cfc2fd9 100644 (file)
@@ -222,7 +222,7 @@ void FormTabular::update()
                }
                pwidth = tabular->GetMColumnPWidth(cell);
                align = tabular->GetAlignment(cell);
                }
                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);
                        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_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);
 
        } 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);
        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);
                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);
 
        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());
        setEnabled(column_options_->radio_valign_top,    !pwidth.zero());
        setEnabled(column_options_->radio_valign_bottom, !pwidth.zero());
        setEnabled(column_options_->radio_valign_center, !pwidth.zero());
index 7450237ae22aab33e45203d6ad0edf109464c2cd..94078b90ff4710f89d27894ff1804058b99c5b53 100644 (file)
@@ -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 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";
index 9ac39db2c5545e11dc35bc8a20aa245341485b18..b7461115bef0b26479990eedbb1c417b614d8fa5 100644 (file)
@@ -49,5 +49,7 @@ extern string const boldsymbol_def;
 extern string const binom_def;
 ///
 extern string const mathcircumflex_def;
 extern string const binom_def;
 ///
 extern string const mathcircumflex_def;
+///
+extern string const tabularnewline_def;
 
 #endif // LYX_STY_H
 
 #endif // LYX_STY_H
index 68696aadd9d5457263079e8d33861969064b21eb..74c9caa17e6be5cca6050245954a404530892c25 100644 (file)
@@ -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;
        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!
        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;
        }
                }
                ++cell;
        }
-       os << "\\\\\n";
+       os << "\\tabularnewline\n";
        ++ret;
        ret += TeXBottomHLine(os, i);
        return ret;
        ++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()) {
                        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";
                                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
 {
 
 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 (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);
        }
                        features.require("array");
                GetCellInset(cell)->validate(features);
        }