math_parser.h \
math_rootinset.C \
math_rootinset.h \
- math_scopeinset.C \
- math_scopeinset.h \
math_scriptinset.C \
math_scriptinset.h \
math_sizeinset.C \
#include "math_charinset.h"
#include "math_deliminset.h"
#include "math_matrixinset.h"
-#include "math_scopeinset.h"
#include "math_scriptinset.h"
#include "math_spaceinset.h"
#include "math_parser.h"
return;
}
- if (c == '{') {
- niceInsert(new MathScopeInset);
+ if (c == '{' || c == '}') {
+ niceInsert(new MathCharInset(c, LM_TC_SPECIAL));
return;
}
- if (c == '}') // ignore it
- return;
-
if (isalpha(c) && (lastcode_ == LM_TC_GREEK || lastcode_ == LM_TC_GREEK1)) {
static char const greek[26] =
{'A', 'B', 'X', 0 , 'E', 0 , 0 , 'H', 'I', 0 ,
#include "math_macrotemplate.h"
#include "math_matrixinset.h"
#include "math_rootinset.h"
-#include "math_scopeinset.h"
#include "math_sqrtinset.h"
#include "math_scriptinset.h"
#include "math_sqrtinset.h"
}
}
-#if 0
+#if 1
lyxerr << "\nTokens: ";
for (unsigned i = 0; i < tokens_.size(); ++i)
lyxerr << tokens_[i];
}
if (flags & FLAG_BLOCK) {
- if (t.cat() == catEnd || t.cat() == catAlign || t.cs() == "\\")
+ if (t.cat() == catAlign || t.cs() == "\\")
return;
if (t.cs() == "end") {
getArg('{', '}');
}
else if (t.cat() == catBegin) {
- //lyxerr << " creating ScopeInset\n";
- array.push_back(new MathScopeInset);
- parse_into(array.back()->cell(0), FLAG_BRACE_LAST);
+ array.push_back(new MathCharInset('{', LM_TC_SPECIAL));
}
else if (t.cat() == catEnd) {
- if (!(flags & FLAG_BRACE_LAST))
- lyxerr << " ##### unexpected end of block\n";
- return;
+ if (flags & FLAG_BRACE_LAST)
+ return;
+ array.push_back(new MathCharInset('}', LM_TC_SPECIAL));
}
else if (t.cat() == catAlign) {
else if (t.cs() == "choose" || t.cs() == "over" || t.cs() == "atop") {
limits = 0;
MathInset * p = createMathInset(t.cs());
- p->cell(0).swap(array);
+ // search backward for position of last '{' if any
+ int pos;
+ for (pos = array.size() - 1; pos >= 0; --pos) {
+ MathInset * q = array.nextInset(pos);
+ if (q->getChar() == '{' && q->code() == LM_TC_SPECIAL)
+ break;
+ }
+ if (pos >= 0) {
+ // found it -> use the part after '{' as "numerator", erase the '{'
+ p->cell(0) = MathArray(array, pos + 1, array.size());
+ array.erase(pos, array.size());
+ } else {
+ // not found -> use everything as "numerator"
+ p->cell(0).swap(array);
+ }
array.push_back(p);
parse_into(p->cell(1), FLAG_BLOCK);
}
+++ /dev/null
-#ifdef __GNUG__
-#pragma implementation
-#endif
-
-#include "math_scopeinset.h"
-#include "LColor.h"
-#include "Painter.h"
-#include "support.h"
-#include "support/LOstream.h"
-
-
-MathScopeInset::MathScopeInset()
- : MathNestInset(1)
-{}
-
-
-MathInset * MathScopeInset::clone() const
-{
- return new MathScopeInset(*this);
-}
-
-
-void MathScopeInset::metrics(MathStyles st) const
-{
- xcell(0).metrics(st);
- size_ = st;
- ascent_ = xcell(0).ascent();
- descent_ = xcell(0).descent();
- width_ = xcell(0).width() + mathed_string_width(LM_TC_TEX, st, "{}");
-}
-
-
-void MathScopeInset::draw(Painter & pain, int x, int y) const
-{
- xo(x);
- yo(y);
- int d = mathed_char_width(LM_TC_TEX, size_, '{');
- drawChar(pain, LM_TC_TEX, size_, x, y, '{');
- xcell(0).draw(pain, x + d, y);
- drawChar(pain, LM_TC_TEX, size_, x + width_ - d, y, '}');
- //pain.rectangle(x, y - ascent_, width_, height(), LColor::mathline);
-}
-
-
-void MathScopeInset::write(std::ostream & os, bool fragile) const
-{
- os << '{';
- cell(0).write(os, fragile);
- os << '}';
-}
-
-
-void MathScopeInset::writeNormal(std::ostream & os) const
-{
- os << "[scope ";
- cell(0).writeNormal(os);
- os << "] ";
-}
+++ /dev/null
-// -*- C++ -*-
-#ifndef MATH_SCOPEINSET_H
-#define MATH_SCOPEINSET_H
-
-#include "math_nestinset.h"
-
-#ifdef __GNUG__
-#pragma interface
-#endif
-
-/** An inset for new scopes (i.e. {....} blocks in LaTeX)
- \author André Pönitz
- */
-class MathScopeInset : public MathNestInset {
-public:
- ///
- MathScopeInset();
- ///
- MathInset * clone() const;
- ///
- void draw(Painter &, int x, int y) const;
- ///
- void write(std::ostream &, bool fragile) const;
- ///
- void writeNormal(std::ostream &) const;
- ///
- void metrics(MathStyles st) const;
-};
-#endif