Finxing Umlauts, Part I

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3503 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2002-02-08 08:03:38 +00:00
parent 2dd83864e5
commit ffabba6156
8 changed files with 115 additions and 26 deletions

View 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

View 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

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

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

View 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

View File

@ -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 << "]";
}

View File

@ -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

View File

@ -19,6 +19,8 @@ public:
void metrics(MathMetricsInfo const & st) const;
///
MathXYMatrixInset * asXYMatrixInset() { return this; }
///
void normalize();
///
void write(WriteStream & os) const;