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
This commit is contained in:
André Pönitz 2001-11-27 13:57:49 +00:00
parent 4637f33070
commit d15b566887
3 changed files with 27 additions and 8 deletions

View File

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

View File

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

View File

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