]> git.lyx.org Git - lyx.git/commitdiff
Correct drawing of the multline environment.
authorDekel Tsur <dekelts@tau.ac.il>
Mon, 12 Feb 2001 11:56:08 +0000 (11:56 +0000)
committerDekel Tsur <dekelts@tau.ac.il>
Mon, 12 Feb 2001 11:56:08 +0000 (11:56 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1485 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/formula.C
src/mathed/math_cursor.C
src/mathed/math_defs.h
src/mathed/math_inset.C

index 4a9e426728383cb719915b9e71dafd83e532067c..4535c63426b38130d12c8e435fa256c28921af2f 100644 (file)
@@ -1,3 +1,9 @@
+2001-02-12  Dekel Tsur  <dekelts@tau.ac.il>
+
+       * formula.C (LocalDispatch): Change the default action of
+       break-line to create an align* environment instead of eqnarray*.
+
+       * math_inset.C (Metrics): Correct drawing of the multline environment.
 
 2001-02-12  André Pönitz  <poenitz@htwm.de>
        * array.[hC]: replace private variable maxsize_ with call 
index ac6d2aa7529056db80c60e48afd7bb7b2863d589..0e4b64c45dc70fcfa3bcbbe19ec585febdd60921 100644 (file)
@@ -76,6 +76,7 @@ MathedCursor * InsetFormula::mathcursor = 0;
 int MathedInset::df_asc;
 int MathedInset::df_des;
 int MathedInset::df_width;
+int MathedInset::workWidth;
 
 
 static
@@ -407,8 +408,9 @@ int InsetFormula::descent(BufferView *, LyXFont const &) const
 }
 
 
-int InsetFormula::width(BufferView *, LyXFont const & f) const
+int InsetFormula::width(BufferView * bv, LyXFont const & f) const
 {
+    MathedInset::workWidth = bv->workWidth();
     lfont_size = f.size();
     par->Metrics();
     return par->Width(); //+2;
@@ -418,6 +420,7 @@ int InsetFormula::width(BufferView *, LyXFont const & f) const
 void InsetFormula::draw(BufferView * bv, LyXFont const & f,
                        int baseline, float & x, bool) const
 {
+       MathedInset::workWidth = bv->workWidth();
        Painter & pain = bv->painter();
        // Seems commenting out solves a problem.
        LyXFont font = mathed_get_font(LM_TC_TEXTRM, LM_ST_TEXT);
@@ -790,7 +793,7 @@ InsetFormula::LocalDispatch(BufferView * bv,
     case LFUN_BREAKLINE:
     {
       bv->lockedInsetStoreUndo(Undo::INSERT);
-      byte c = arg.empty() ? 'e' : arg[0];
+      byte c = arg.empty() ? '1' : arg[0];
       mathcursor->Insert(c, LM_TC_CR);
       if (!label.empty()) {
         mathcursor->setLabel(label);
index e8d48803a2ed35764403d9b12bdef97d4333890e..f05d9eb291c3b75d031cec01c7bc83333fd1d56b 100644 (file)
@@ -352,7 +352,7 @@ MathMatrixInset * create_multiline(short int type, int cols)
        case LM_OT_MULTLINE:
        case LM_OT_MULTLINEN:
                columns = 1;
-               align = "c"; // This is incorrect!
+               align = "C";
                break;
        case LM_OT_MPAR:
        case LM_OT_MPARN:
index 2a01d91fd23ab47645e2af7da3fa1fbb04ed41e7..47dd11435768d1cb03d3a439cd63a46b1056c3ad 100644 (file)
@@ -263,6 +263,8 @@ class MathedInset  {
     virtual void  SetStyle(short st) { size = st; } // Metrics();
     ///
     virtual void  SetName(string const & n) { name = n; }
+    ///
+    static int workWidth;
  protected:
     ///
     string name;
index d09a80d01e14eab62cb9f98288bde72842a166f3..58af303bb7a31b038184aea13d244552322d61b9 100644 (file)
@@ -468,6 +468,10 @@ void MathMatrixInset::Metrics()
     for (i = 1; i < nc; ++i)
        if (h_align[i] == 'R')
            ws[i] += 10*df_width;
+    // Increase ws[i] for 'C' column
+    if (h_align[0] == 'C')
+       if (ws[0] < 7*workWidth/8)
+           ws[0] = 7*workWidth/8;
 
    // Adjust local tabs
     cxrow = row;
@@ -491,6 +495,14 @@ void MathMatrixInset::Metrics()
            case 'R':
                lf = ws[i] - cxrow->getTab(i);
                break;
+           case 'C':
+               if (cxrow == row)
+                   lf = 0;
+               else if (!cxrow->getNext())
+                    lf = ws[i] - cxrow->getTab(i);
+               else
+                   lf = (ws[i] - cxrow->getTab(i))/2; 
+               break;
            }
            ww = (isvoid) ? lf : lf + cxrow->getTab(i);
            cxrow->setTab(i, lf + rg);