mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
re-enable { and } in seperate cells;
nuke MathScopeInset; git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2620 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
592c50de2f
commit
f1e2433313
@ -76,8 +76,6 @@ libmathed_la_SOURCES = \
|
||||
math_parser.h \
|
||||
math_rootinset.C \
|
||||
math_rootinset.h \
|
||||
math_scopeinset.C \
|
||||
math_scopeinset.h \
|
||||
math_scriptinset.C \
|
||||
math_scriptinset.h \
|
||||
math_sizeinset.C \
|
||||
|
@ -35,7 +35,6 @@
|
||||
#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"
|
||||
@ -1300,14 +1299,11 @@ void MathCursor::interpret(string const & s)
|
||||
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 ,
|
||||
|
@ -37,7 +37,6 @@
|
||||
#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"
|
||||
@ -439,7 +438,7 @@ void Parser::tokenize(string const & buffer)
|
||||
}
|
||||
}
|
||||
|
||||
#if 0
|
||||
#if 1
|
||||
lyxerr << "\nTokens: ";
|
||||
for (unsigned i = 0; i < tokens_.size(); ++i)
|
||||
lyxerr << tokens_[i];
|
||||
@ -655,7 +654,7 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
|
||||
}
|
||||
|
||||
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('{', '}');
|
||||
@ -683,15 +682,13 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
|
||||
}
|
||||
|
||||
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) {
|
||||
@ -848,7 +845,21 @@ void Parser::parse_into(MathArray & array, unsigned flags, MathTextCodes code)
|
||||
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);
|
||||
}
|
||||
|
@ -1,58 +0,0 @@
|
||||
#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 << "] ";
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
// -*- 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
|
Loading…
Reference in New Issue
Block a user