#include "InsetMathBrace.h"
#include "InsetMathColor.h"
#include "InsetMathComment.h"
#include "InsetMathBrace.h"
#include "InsetMathColor.h"
#include "InsetMathComment.h"
#include "InsetMathScript.h"
#include "InsetMathSpace.h"
#include "InsetMathSymbol.h"
#include "InsetMathScript.h"
#include "InsetMathSpace.h"
#include "InsetMathSymbol.h"
{
// FIXME: This is a hack. Ideally, the coord cache should not store
// absolute positions, but relative ones. This would mean to call
{
// FIXME: This is a hack. Ideally, the coord cache should not store
// absolute positions, but relative ones. This would mean to call
// with the correctly adjusted x,y values. But this means that we'd have
// to touch all (math)inset's draw() methods. Right now, we'll store
// absolute value, and make them here relative, only to make them
// absolute again when actually drawing the cursor. What a mess.
BOOST_ASSERT(ptr_cmp(&sl.inset(), this));
// with the correctly adjusted x,y values. But this means that we'd have
// to touch all (math)inset's draw() methods. Right now, we'll store
// absolute value, and make them here relative, only to make them
// absolute again when actually drawing the cursor. What a mess.
BOOST_ASSERT(ptr_cmp(&sl.inset(), this));
CoordCache const & coord_cache = bv.coordCache();
if (!coord_cache.getArrays().has(&ar)) {
// this can (semi-)legally happen if we just created this cell
CoordCache const & coord_cache = bv.coordCache();
if (!coord_cache.getArrays().has(&ar)) {
// this can (semi-)legally happen if we just created this cell
{
BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
if (cur.idx() == cur.lastidx())
{
BOOST_ASSERT(ptr_cmp(&cur.inset(), this));
if (cur.idx() == cur.lastidx())
#if 0
if (lock_)
pi.pain.fillRectangle(x, y - ascent(), width(), height(),
#if 0
if (lock_)
pi.pain.fillRectangle(x, y - ascent(), width(), height(),
{
BufferView & bv = *pi.base.bv;
// this should use the x/y values given, not the cached values
{
BufferView & bv = *pi.base.bv;
// this should use the x/y values given, not the cached values
//lyxerr << "InsetMathNest::drawing selection: "
// << " s1: " << s1 << " s2: " << s2 << endl;
if (s1.idx() == s2.idx()) {
//lyxerr << "InsetMathNest::drawing selection: "
// << " s1: " << s1 << " s2: " << s2 << endl;
if (s1.idx() == s2.idx()) {
int x1 = c.xo(bv) + c.pos2x(s1.pos());
int y1 = c.yo(bv) - c.ascent();
int x2 = c.xo(bv) + c.pos2x(s2.pos());
int y2 = c.yo(bv) + c.descent();
int x1 = c.xo(bv) + c.pos2x(s1.pos());
int y1 = c.yo(bv) - c.ascent();
int x2 = c.xo(bv) + c.pos2x(s2.pos());
int y2 = c.yo(bv) + c.descent();
- pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection);
+ pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, Color::selection);
//lyxerr << "InsetMathNest::drawing selection 3: "
// << " x1: " << x1 << " x2: " << x2
// << " y1: " << y1 << " y2: " << y2 << endl;
} else {
for (idx_type i = 0; i < nargs(); ++i) {
if (idxBetween(i, s1.idx(), s2.idx())) {
//lyxerr << "InsetMathNest::drawing selection 3: "
// << " x1: " << x1 << " x2: " << x2
// << " y1: " << y1 << " y2: " << y2 << endl;
} else {
for (idx_type i = 0; i < nargs(); ++i) {
if (idxBetween(i, s1.idx(), s2.idx())) {
int x1 = c.xo(bv);
int y1 = c.yo(bv) - c.ascent();
int x2 = c.xo(bv) + c.width();
int y2 = c.yo(bv) + c.descent();
int x1 = c.xo(bv);
int y1 = c.yo(bv) - c.ascent();
int x2 = c.xo(bv) + c.width();
int y2 = c.yo(bv) + c.descent();
- pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, LColor::selection);
+ pi.pain.fillRectangle(x1, y1, x2 - x1, y2 - y1, Color::selection);
// remove base-only "scripts"
for (pos_type i = 0; i + 1 < ar.size(); ++i) {
InsetMathScript * p = operator[](i).nucleus()->asScriptInset();
if (p && p->nargs() == 1) {
// remove base-only "scripts"
for (pos_type i = 0; i + 1 < ar.size(); ++i) {
InsetMathScript * p = operator[](i).nucleus()->asScriptInset();
if (p && p->nargs() == 1) {
{
handleFont(cur, arg, from_ascii(font));
}
void InsetMathNest::handleFont
{
handleFont(cur, arg, from_ascii(font));
}
void InsetMathNest::handleFont
if (cur.pos() != cur.lastpos() && cur.openable(cur.nextAtom())) {
cur.pushLeft(*cur.nextAtom().nucleus());
cur.inset().idxFirst(cur);
if (cur.pos() != cur.lastpos() && cur.openable(cur.nextAtom())) {
cur.pushLeft(*cur.nextAtom().nucleus());
cur.inset().idxFirst(cur);
// cmd.argument is the next character of the macro name.
// Otherwise we'll get an invalid cursor if we undo after
// the macro was finished and the macro is a known command,
// cmd.argument is the next character of the macro name.
// Otherwise we'll get an invalid cursor if we undo after
// the macro was finished and the macro is a known command,
// the InsetMathUnknown with name "frac" by an empty
// InsetMathFrac -> a pos value > 0 is invalid.
// A side effect is that an undo before the macro is finished
// the InsetMathUnknown with name "frac" by an empty
// InsetMathFrac -> a pos value > 0 is invalid.
// A side effect is that an undo before the macro is finished
cur.niceInsert(MathAtom(new InsetMathHull("simple")));
cur.message(_("create new math text environment ($...$)"));
} else {
cur.niceInsert(MathAtom(new InsetMathHull("simple")));
cur.message(_("create new math text environment ($...$)"));
} else {
data = tmp.createDialogStr(to_utf8(name));
}
cur.bv().showInsetDialog(to_utf8(name), data, 0);
data = tmp.createDialogStr(to_utf8(name));
}
cur.bv().showInsetDialog(to_utf8(name), data, 0);
// cur.result().update(): don't overwrite previously set flags.
cur.updateFlags(Update::Decoration | Update::FitCursor | cur.result().update());
} else if (cmd.button() == mouse_button::button2) {
// cur.result().update(): don't overwrite previously set flags.
cur.updateFlags(Update::Decoration | Update::FitCursor | cur.result().update());
} else if (cmd.button() == mouse_button::button2) {
cap::copySelectionToStack();
cmd = FuncRequest(LFUN_PASTE, "0");
doDispatch(cur, cmd);
cap::copySelectionToStack();
cmd = FuncRequest(LFUN_PASTE, "0");
doDispatch(cur, cmd);