X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fmathed%2Fformula.C;h=164efb4a30b84d3f15dc2b6bc3fab014d2bfc4df;hb=e07f7bcc50358fe9b7d68955de145b7249248c7b;hp=6456dfad9972165587ea57b926195a293204c9f2;hpb=9a3176581dc3e9aee62d908faf8d48ddb43d4cc3;p=lyx.git diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 6456dfad99..164efb4a30 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -227,7 +227,7 @@ InsetFormula::InsetFormula(MathParInset * p) par = is_multiline(p->GetType()) ? new MathMatrixInset(static_cast(p)): - new MathParInset(p); + new MathParInset(*p); // mathcursor = 0; disp_flag = (par->GetType()>0); @@ -305,7 +305,8 @@ void InsetFormula::Read(Buffer const *, LyXLex & lex) // Silly hack to read labels. mathed_label.erase(); - mathed_parse(0, 0, &par); + MathedArray ar; + mathed_parse(ar, 0, &par); par->Metrics(); disp_flag = (par->GetType() > 0); @@ -537,9 +538,6 @@ void InsetFormula::display(bool dspf) par->SetStyle(LM_ST_DISPLAY); } else { if (is_multiline(par->GetType())) { - MathParInset * p = new MathParInset(par); - delete par; - par = p; if (mathcursor) mathcursor->SetPar(par); } @@ -663,7 +661,8 @@ bool InsetFormula::SetNumber(bool numbf) UpdatableInset::RESULT -InsetFormula::LocalDispatch(BufferView * bv, int action, string const & arg) +InsetFormula::LocalDispatch(BufferView * bv, kb_action action, + string const & arg) { // extern char *dispatch_result; MathedTextCodes varcode = LM_TC_MIN; @@ -945,7 +944,7 @@ InsetFormula::LocalDispatch(BufferView * bv, int action, string const & arg) if (mathcursor && p) { if (k > 2 && int(strlen(s)) > m) p->SetAlign(s[0], &s[1]); - mathcursor->Insert(p, LM_TC_ACTIVE_INSET); + mathcursor->insertInset(p, LM_TC_ACTIVE_INSET); UpdateLocal(bv); } break; @@ -993,7 +992,7 @@ InsetFormula::LocalDispatch(BufferView * bv, int action, string const & arg) } MathDelimInset * p = new MathDelimInset(ilf, irg); - mathcursor->Insert(p, LM_TC_ACTIVE_INSET); + mathcursor->insertInset(p, LM_TC_ACTIVE_INSET); UpdateLocal(bv); break; } @@ -1001,7 +1000,7 @@ InsetFormula::LocalDispatch(BufferView * bv, int action, string const & arg) case LFUN_PROTECTEDSPACE: bv->lockedInsetStoreUndo(Undo::INSERT); sp = new MathSpaceInset(1); - mathcursor->Insert(sp); + mathcursor->insertInset(sp, LM_TC_INSET); space_on = true; UpdateLocal(bv); break; @@ -1227,7 +1226,7 @@ InsetFormula::LocalDispatch(BufferView * bv, int action, string const & arg) static void mathedValidate(LaTeXFeatures & features, MathParInset * par) { - MathedIter it(par->GetData()); + MathedIter it(&par->GetData()); while (it.OK() && !(features.binom && features.boldsymbol)) { if (it.IsInset()) {