Correct drawing of the multline environment.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1485 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2001-02-12 11:56:08 +00:00
parent 408b556ed9
commit 8ccdbef7a0
5 changed files with 26 additions and 3 deletions

View 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

View 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);

View 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:

View 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;

View 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);