Write(os, true);
}
+
+void MathArray::Validate(LaTeXFeatures & features) const
+{
+ for (int pos = 0; pos < size(); next(pos))
+ if (isInset(pos))
+ nextInset(pos)->Validate(features);
+}
+
class MathInset;
class MathMacro;
class Painter;
+class LaTeXFeatures;
#ifdef __GNUG__
#pragma interface
void Write(std::ostream &, bool) const;
///
void WriteNormal(std::ostream &) const;
+ ///
+ void Validate(LaTeXFeatures &) const;
private:
///
typedef std::vector<unsigned char> buffer_type;
{
int x = int(xx) - 1;
y -= 2;
+
MathInset::workwidth = bv->workWidth();
Painter & pain = bv->painter();
int w = par()->width();
int h = par()->height();
int a = par()->ascent();
- pain.fillRectangle(int(x), y - a, w, h, LColor::mathbg);
-
- if (mathcursor) {
- if (mathcursor->formula() == this) {
- if (mathcursor->Selection()) {
- int xp[10];
- int yp[10];
- int n;
- mathcursor->SelGetArea(xp, yp, n);
- pain.fillPolygon(xp, yp, n, LColor::selection);
- }
- pain.rectangle(int(x), y - a, w, h, LColor::mathframe);
+ pain.fillRectangle(x, y - a, w, h, LColor::mathbg);
+
+ if (mathcursor && mathcursor->formula() == this) {
+ if (mathcursor->Selection()) {
+ int xp[10];
+ int yp[10];
+ int n;
+ mathcursor->SelGetArea(xp, yp, n);
+ pain.fillPolygon(xp, yp, n, LColor::selection);
}
+ pain.rectangle(x, y - a, w, h, LColor::mathframe);
}
- par()->draw(pain, int(x), y);
+ par()->draw(pain, x, y);
xx += par()->width();
setCursorVisible(false);
break;
case LFUN_BACKSPACE:
- if (!mathcursor->InMacroMode() && mathcursor->pos() == 0) {
+ // if (!mathcursor->InMacroMode() && mathcursor->pos() == 0)
+ if (mathcursor->pos() == 0) {
bv->lockedInsetStoreUndo(Undo::DELETE);
mathcursor->pullArg();
bv->updateInset(this, true);
break;
}
- if (!mathcursor->Left())
- break;
+ mathcursor->plainLeft();
// fall through...
case LFUN_DELETE:
}
+bool MathCursor::plainLeft()
+{
+ return array().prev(cursor_);
+}
+
bool MathCursor::Left(bool sel)
{
dump("Left 1");
MacroModeClose();
return true;
}
- clearLastCode();
SelHandle(sel);
+ clearLastCode();
bool result = false;
MacroModeClose();
return true;
}
-
- clearLastCode();
SelHandle(sel);
+ clearLastCode();
bool result = false;
if (macro_mode)
MacroModeClose();
clearLastCode();
- if (!par_->idxHome(idx_, cursor_)) {
+ if (!par_->idxHome(idx_, cursor_))
pop();
- }
dump("Home 2");
}
/// Put the cursor in the last position
void last();
///
+ bool plainLeft();
+ ///
bool plainRight();
///
void Delete();
y >= yo_ - ascent_ &&
y <= yo_ + descent_;
}
+
+void MathInset::Validate(LaTeXFeatures & features) const
+{
+ for (int i = 0; i < nargs(); ++i)
+ cell(i).Validate(features);
+}
*/
+class LaTeXFeatures;
+
class MathInset {
public:
/** A math inset has a name (usually its LaTeX name),
void dump() const;
///
+ void Validate(LaTeXFeatures & features) const;
+
///
static int workwidth;
protected:
#include "math_macrotable.h"
#include "math_macrotemplate.h"
#include "Painter.h"
+#include "LaTeXFeatures.h"
using std::endl;
{
return false;
}
+
+
+void MathMacro::Validate(LaTeXFeatures & features) const
+{
+ if (name_ == "binom")
+ features.binom = true;
+ MathInset::Validate(features);
+}
///
bool idxRight(int &, int &) const;
+ ///
+ void Validate(LaTeXFeatures &) const;
+
private:
///
MathMacroTemplate const * const tmplate_;
}
-void MathMatrixInset::Validate(LaTeXFeatures & features)
+void MathMatrixInset::Validate(LaTeXFeatures & features) const
{
features.amsstyle = ams();
//if (features.amsstyle)
// return;
- //Validate1(features);
-
features.boldsymbol = true;
- features.binom = true;
-}
+ //features.binom = true;
-/*
-void MathMatrixInset::Validate1(LaTeXFeatures & features)
-{
- MathIter it(cell());
-
- while (it.OK() && !(features.binom && features.boldsymbol)) {
- MathInset * p = it.nextInset();
- if (p) {
- p = it.GetActiveInset();
- if (p) {
- if (!features.binom && p->GetType() == LM_OT_MACRO &&
- p->name() == "binom") {
- features.binom = true;
- } else {
- for (int i = 0; i <= p->getMaxArgumentIdx(); ++i) {
- p->setArgumentIdx(i);
- Validate1(features, p);
- }
- }
- } else {
- if (!features.boldsymbol && p->name() == "boldsymbol")
- features.boldsymbol = true;
- }
- }
- it.Next();
- }
+ MathInset::Validate(features);
}
-*/
void MathMatrixInset::header_write(std::ostream & os) const
///
std::vector<string> const getLabelList() const;
///
- void Validate(LaTeXFeatures & features);
+ void Validate(LaTeXFeatures & features) const;
///
void addRow(int);