diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 87d2f0a23d..e243412a1f 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,9 @@ + +2002-02-08 Martin Vermeer + + * formulabase.C (localDispatch): fix umlaut handling + + 2002-02-01 André Pönitz * math_xarrowinset.[Ch]: support for \xrightarrow and \xleftarrow diff --git a/src/mathed/Makefile.am b/src/mathed/Makefile.am index 4a400b3647..390f0ee883 100644 --- a/src/mathed/Makefile.am +++ b/src/mathed/Makefile.am @@ -131,5 +131,7 @@ libmathed_la_SOURCES = \ math_xarrowinset.h \ math_xdata.C \ math_xdata.h \ + math_xyarrowinset.C \ + math_xyarrowinset.h \ math_xymatrixinset.C \ math_xymatrixinset.h diff --git a/src/mathed/formulabase.C b/src/mathed/formulabase.C index c45ed73a45..276200e3b9 100644 --- a/src/mathed/formulabase.C +++ b/src/mathed/formulabase.C @@ -517,19 +517,32 @@ InsetFormulaBase::localDispatch(BufferView * bv, kb_action action, case LFUN_WORDLEFTSEL: break; - // --- accented characters ------------------------------ - - case LFUN_UMLAUT: handleAccent(bv, arg, "ddot"); break; - case LFUN_CIRCUMFLEX: handleAccent(bv, arg, "hat"); break; - case LFUN_GRAVE: handleAccent(bv, arg, "grave"); break; - case LFUN_ACUTE: handleAccent(bv, arg, "acute"); break; - case LFUN_TILDE: handleAccent(bv, arg, "tilde"); break; - case LFUN_MACRON: handleAccent(bv, arg, "bar"); break; - case LFUN_DOT: handleAccent(bv, arg, "dot"); break; - case LFUN_CARON: handleAccent(bv, arg, "check"); break; - case LFUN_BREVE: handleAccent(bv, arg, "breve"); break; - case LFUN_VECTOR: handleAccent(bv, arg, "vec"); break; - case LFUN_UNDERBAR: handleAccent(bv, arg, "underbar"); break; + // Special casing for superscript in case of LyX handling + // dead-keys: + case LFUN_CIRCUMFLEX: + if (arg.empty()) { + // do superscript if LyX handles + // deadkeys + bv->lockedInsetStoreUndo(Undo::EDIT); + mathcursor->script(true); + updateLocal(bv, true); + } + break; + case LFUN_UMLAUT: + case LFUN_ACUTE: + case LFUN_GRAVE: + case LFUN_BREVE: + case LFUN_DOT: + case LFUN_MACRON: + case LFUN_CARON: + case LFUN_TILDE: + case LFUN_CEDILLA: + case LFUN_CIRCLE: + case LFUN_UNDERDOT: + case LFUN_TIE: + case LFUN_OGONEK: + case LFUN_HUNG_UMLAUT: + break; // Math fonts case LFUN_GREEK_TOGGLE: handleFont(bv, arg, LM_TC_GREEK); break; @@ -801,18 +814,6 @@ bool InsetFormulaBase::searchBackward(BufferView * bv, string const & what, } - -void InsetFormulaBase::handleAccent(BufferView * bv, - string const & arg, string const & name) -{ - bv->lockedInsetStoreUndo(Undo::EDIT); - MathAtom at = createMathInset(name); - mathed_parse_cell(at->cell(0), arg); - mathcursor->insert(at); - updateLocal(bv, true); -} - - ///////////////////////////////////////////////////////////////////// diff --git a/src/mathed/math_factory.C b/src/mathed/math_factory.C index 540c86e1a0..02a5d98687 100644 --- a/src/mathed/math_factory.C +++ b/src/mathed/math_factory.C @@ -25,6 +25,7 @@ #include "math_unknowninset.h" #include "math_xarrowinset.h" #include "math_xymatrixinset.h" +#include "math_xyarrowinset.h" MathAtom createMathInset(latexkeys const * l) diff --git a/src/mathed/math_parser.C b/src/mathed/math_parser.C index 313d235444..08d06ca3af 100644 --- a/src/mathed/math_parser.C +++ b/src/mathed/math_parser.C @@ -1074,11 +1074,15 @@ void Parser::parse_into1(MathArray & array, unsigned flags, MathTextCodes code) else if (t.cs() == "xymatrix") { array.push_back(createMathInset(t.cs())); parse_lines2(array.back()); - // skip closing brace } // Disabled #if 0 + else if (0 && t.cs() == "ar") { + array.push_back(createMathInset(t.cs())); + parse_lines2(array.back()); + } + else if (t.cs() == "mbox") { array.push_back(createMathInset(t.cs())); // slurp in the argument of mbox diff --git a/src/mathed/math_xyarrowinset.C b/src/mathed/math_xyarrowinset.C new file mode 100644 index 0000000000..b582a2b58b --- /dev/null +++ b/src/mathed/math_xyarrowinset.C @@ -0,0 +1,42 @@ +#include + +#ifdef __GNUG__ +#pragma implementation +#endif + +#include "math_xyarrowinset.h" +#include "math_mathmlstream.h" +#include "math_streamstr.h" + + +MathXYArrowInset::MathXYArrowInset() + : MathNestInset(1) +{} + + +MathInset * MathXYArrowInset::clone() const +{ + return new MathXYArrowInset(*this); +} + + +void MathXYArrowInset::metrics(MathMetricsInfo const & mi) const +{ + MathNestInset::metrics(mi); +} + + +void MathXYArrowInset::write(WriteStream & os) const +{ + os << "\\ar{"; + MathNestInset::write(os); + os << "}\n"; +} + + +void MathXYArrowInset::normalize(NormalStream & os) const +{ + os << "[xyarrow "; + MathNestInset::normalize(os); + os << "]"; +} diff --git a/src/mathed/math_xyarrowinset.h b/src/mathed/math_xyarrowinset.h new file mode 100644 index 0000000000..45cde7f49c --- /dev/null +++ b/src/mathed/math_xyarrowinset.h @@ -0,0 +1,31 @@ +// -*- C++ -*- +#ifndef MATH_XYARROWINSET_H +#define MATH_ARROWINSET_H + +#include "math_nestinset.h" + +#ifdef __GNUG__ +#pragma interface +#endif + + +class MathXYArrowInset : public MathNestInset { +public: + /// + MathXYArrowInset(); + /// + MathInset * clone() const; + /// + void metrics(MathMetricsInfo const & st) const; + /// + MathXYArrowInset * asXYArrowInset() { return this; } + /// + void normalize(); + + /// + void write(WriteStream & os) const; + /// + void normalize(NormalStream &) const; +}; + +#endif diff --git a/src/mathed/math_xymatrixinset.h b/src/mathed/math_xymatrixinset.h index bfebb04da2..bead82a3ee 100644 --- a/src/mathed/math_xymatrixinset.h +++ b/src/mathed/math_xymatrixinset.h @@ -19,6 +19,8 @@ public: void metrics(MathMetricsInfo const & st) const; /// MathXYMatrixInset * asXYMatrixInset() { return this; } + /// + void normalize(); /// void write(WriteStream & os) const;