From d15b5668872e04c1a2db6cafeb076e9c1bf745b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Tue, 27 Nov 2001 13:57:49 +0000 Subject: [PATCH] fix drawing glitch with \int (limits are on the side per default even in displayed formulas) git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@3093 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/math_inset.h | 2 +- src/mathed/math_scriptinset.C | 23 +++++++++++++++++++++-- src/mathed/math_symbolinset.h | 10 +++++----- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/src/mathed/math_inset.h b/src/mathed/math_inset.h index b18d419866..5a9c294e56 100644 --- a/src/mathed/math_inset.h +++ b/src/mathed/math_inset.h @@ -200,7 +200,7 @@ public: virtual MathScriptInset const * asScriptInset() const { return 0; } virtual MathSpaceInset * asSpaceInset() { return 0; } virtual MathStringInset * asStringInset() { return 0; } - virtual MathSymbolInset * asSymbolInset() { return 0; } + virtual MathSymbolInset const * asSymbolInset() const { return 0; } virtual UpdatableInset * asHyperActiveInset() const { return 0; } /// identifies things that can get scripts diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index bff30b20f1..f4559bb69f 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -3,10 +3,11 @@ #endif #include "math_scriptinset.h" -#include "debug.h" #include "math_support.h" +#include "math_symbolinset.h" #include "math_mathmlstream.h" #include "support/LAssert.h" +#include "debug.h" MathScriptInset::MathScriptInset() @@ -230,7 +231,25 @@ void MathScriptInset::draw(MathInset const * nuc, Painter & pain, bool MathScriptInset::hasLimits(MathInset const * nuc) const { - return limits_ == 1 || (limits_ == 0 && nuc && nuc->isScriptable()); + // obviuos cases + if (limits_ == 1) + return true; + if (limits_ == -1) + return false; + + // we can only display limits if the nucleus wants some + if (!nuc) + return false; + if (!nuc->isScriptable()) + return false; + + // per default \int has limits beside the \int even in displayed formulas + if (nuc->asSymbolInset()) + if (nuc->asSymbolInset()->name().find("int") != string::npos) + return false; + + // assume "real" limits for everything else + return true; } diff --git a/src/mathed/math_symbolinset.h b/src/mathed/math_symbolinset.h index b83f5b5f9b..f92a5c09b1 100644 --- a/src/mathed/math_symbolinset.h +++ b/src/mathed/math_symbolinset.h @@ -23,13 +23,13 @@ public: void draw(Painter &, int x, int y) const; /// bool isRelOp() const; - /// + /// do we take scripts? bool isScriptable() const; - /// identifies things that can get \limits or \nolimits + /// do we take \limits or \nolimits? bool takesLimits() const; - /// - MathSymbolInset * asSymbolInset() { return this; } - /// + /// identifies SymbolInset as such + MathSymbolInset const * asSymbolInset() const { return this; } + /// the LaTeX name of the symbol (without the backslash) string name() const; /// bool match(MathInset *) const;