]> git.lyx.org Git - features.git/commitdiff
Finxing Umlauts, Part I
authorAndré Pönitz <poenitz@gmx.net>
Fri, 8 Feb 2002 08:03:38 +0000 (08:03 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Fri, 8 Feb 2002 08:03:38 +0000 (08:03 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3503 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/ChangeLog
src/mathed/Makefile.am
src/mathed/formulabase.C
src/mathed/math_factory.C
src/mathed/math_parser.C
src/mathed/math_xyarrowinset.C [new file with mode: 0644]
src/mathed/math_xyarrowinset.h [new file with mode: 0644]
src/mathed/math_xymatrixinset.h

index 87d2f0a23d8e5ae5e0f483d4119614b116c952cc..e243412a1f779f48218a58c44845c1da9103d687 100644 (file)
@@ -1,3 +1,9 @@
+
+2002-02-08  Martin Vermeer  <martin.vermeer@hut.fi>
+
+       * formulabase.C (localDispatch): fix umlaut handling
+
+
 2002-02-01  André Pönitz <poenitz@gmx.net>
 
        * math_xarrowinset.[Ch]: support for \xrightarrow and \xleftarrow
index 4a400b364783a4052558c1a9ecbf243caf1d8ffc..390f0ee883d9c078ae93e55349e62d662e3c5fa7 100644 (file)
@@ -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
index c45ed73a45fffc2e3586afa0f1e34bc290b271c1..276200e3b9c812e4339133e3180cb97c9598c3c6 100644 (file)
@@ -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);
-}
-
-
 /////////////////////////////////////////////////////////////////////
 
 
index 540c86e1a0dad21405b35f16503973d8ea457224..02a5d986871a1e5763d9a21c98fc6189376119b2 100644 (file)
@@ -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)
index 313d2354442632fdce3f7e002cf52bf10b15f78c..08d06ca3afbff5017fa543af73e3c7d98355597c 100644 (file)
@@ -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 (file)
index 0000000..b582a2b
--- /dev/null
@@ -0,0 +1,42 @@
+#include <config.h>
+
+#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 (file)
index 0000000..45cde7f
--- /dev/null
@@ -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
index bfebb04da2d7d3e29abe1ab7516ca86ad70bf91d..bead82a3eef8afd03788bdbcff34da75b60777f7 100644 (file)
@@ -19,6 +19,8 @@ public:
        void metrics(MathMetricsInfo const & st) const;
        ///
        MathXYMatrixInset * asXYMatrixInset() { return this; }
+       ///
+       void normalize();
 
        ///
        void write(WriteStream & os) const;