int hack_button;
-void handleFont(BufferView * bv, string const & arg, MathTextCodes t)
+void handleFont(BufferView * bv, string const & arg, MathTextCodes t)
{
if (mathcursor->selection())
bv->lockedInsetStoreUndo(Undo::EDIT);
{}
-void InsetFormulaBase::metrics(BufferView * bv, LyXFont const & f) const
+void InsetFormulaBase::metrics(BufferView * bv, LyXFont const & f) const
{
font_ = f;
metrics(bv);
}
-void InsetFormulaBase::metrics(BufferView * bv) const
+void InsetFormulaBase::metrics(BufferView * bv) const
{
if (bv)
view_ = bv;
bool InsetFormulaBase::insetButtonRelease(BufferView * bv,
- int /*x*/, int /*y*/, int /*button*/)
+ int /*x*/, int /*y*/, int /*button*/)
{
if (!mathcursor)
return false;
bv->getLyXText()->selectionAsString(bv->buffer(), false);
mathed_parse_cell(ar, sel);
mathcursor->insert(ar);
- }
+ }
break;
*/
case 3:
first_x = x;
first_y = y;
- if (!mathcursor->selection())
+ if (!mathcursor->selection())
mathcursor->selStart();
-
+
//lyxerr << "insetMotionNotify: " << x + xo_ << ' ' << y + yo_
// << ' ' << button << "\n";
hideInsetCursor(bv);
//lyxerr << "InsetFormulaBase::localDispatch: act: " << action
// << " arg: '" << arg << "' cursor: " << mathcursor << "\n";
- if (!mathcursor)
+ if (!mathcursor)
return UNDISPATCHED;
if (mathcursor->asHyperActiveInset()) {
case LFUN_DEFAULT: handleFont(bv, arg, LM_TC_VAR); break;
case LFUN_FREE: handleFont(bv, arg, LM_TC_TEXTRM); break;
- case LFUN_GREEK:
+ case LFUN_GREEK:
handleFont(bv, arg, LM_TC_GREEK1);
if (arg.size())
mathcursor->interpret(arg);
updateLocal(bv, true);
break;
}
-
+
case LFUN_SUPERSCRIPT:
case LFUN_SUBSCRIPT:
{
updateLocal(bv, true);
break;
}
-
+
case LFUN_MATH_DELIM:
{
lyxerr << "formulabase::LFUN_MATH_DELIM, arg: '" << arg << "'\n";
MathInset::idx_type idx = 0;
MathGridInset * p = mathcursor ? mathcursor->enclosingGrid(idx) : 0;
if (p) {
+ mathcursor->popToEnclosingGrid();
bv->lockedInsetStoreUndo(Undo::EDIT);
- char al = arg.size() ? arg[0] : 'c';
+ char align = arg.size() ? arg[0] : 'c';
switch (action) {
- case LFUN_MATH_HALIGN: p->halign(al, p->col(idx)); break;
- case LFUN_MATH_VALIGN: p->valign(al); break;
+ case LFUN_MATH_HALIGN: p->halign(align, p->col(idx)); break;
+ case LFUN_MATH_VALIGN: p->valign(align); break;
case LFUN_MATH_ROW_INSERT: p->addRow(p->row(idx)); break;
case LFUN_MATH_ROW_DELETE: p->delRow(p->row(idx)); break;
case LFUN_MATH_COLUMN_INSERT: p->addCol(p->col(idx)); break;
//lyxerr << "reset lastformula to " << this << "\n";
lastformula = this;
laststr = str;
- current = ibegin(par().nucleus());
+ current = ibegin(par().nucleus());
ar.clear();
mathed_parse_cell(ar, str);
} else {
} else {
// create a macro if we see "\\newcommand" somewhere, and an ordinary
// formula otherwise
- if (sel.find("\\newcommand") == string::npos)
+ if (sel.find("\\newcommand") == string::npos &&
+ sel.find("\\def") == string::npos)
f = new InsetFormula(sel);
else {
string name;
mathDispatchCreation(bv, arg, true);
}
-
+
void mathDispatchMathMode(BufferView * bv, string const & arg)
{
mathDispatchCreation(bv, arg, false);
if (arg.empty())
bv->owner()->getLyXFunc()->setErrorMessage(N_("Missing argument"));
else {
- string s(arg);
+ string s = arg;
string const s1 = token(s, ' ', 1);
int const na = s1.empty() ? 0 : lyx::atoi(s1);
openNewInset(bv, new InsetFormulaMacro(token(s, ' ', 0), na));
void mathDispatchMathDelim(BufferView * bv, string const & arg)
{
- if (bv->available()) {
+ if (bv->available()) {
if (openNewInset(bv, new InsetFormula))
bv->theLockingInset()->localDispatch(bv, LFUN_MATH_DELIM, arg);
}
-}
+}
void mathDispatchInsertMatrix(BufferView * bv, string const & arg)
-{
- if (bv->available()) {
+{
+ if (bv->available()) {
if (openNewInset(bv, new InsetFormula))
bv->theLockingInset()->localDispatch(bv, LFUN_INSERT_MATRIX, arg);
}
-}
+}
void mathDispatchInsertMath(BufferView * bv, string const & arg)
void mathDispatchGreek(BufferView * bv, string const & arg)
-{
- if (bv->available()) {
+{
+ if (bv->available()) {
InsetFormula * f = new InsetFormula;
if (openNewInset(bv, f)) {
bv->theLockingInset()->localDispatch(bv, LFUN_GREEK, arg);
bv->unlockInset(f);
}
}
-}
+}
void mathDispatch(BufferView *, kb_action, string const &)
-{}
+{}