#include "support/lstrings.h"
#include "support/textutils.h"
-#include "support/tostr.h"
+#include "support/convert.h"
#include <sstream>
LyXText::LyXText(BufferView * bv)
: maxwidth_(bv ? bv->workWidth() : 100),
background_color_(LColor::background),
- bv_owner(bv)
+ bv_owner(bv),
+ autoBreakRows_(false)
{}
InsetBase * inset = iit->inset;
#if 1
lyxerr << "examining inset " << inset << endl;
- if (theCoords.insets_.has(inset))
+ if (theCoords.getInsets().has(inset))
lyxerr
<< " xo: " << inset->xo() << "..."
<< inset->xo() + inset->width()
pit_type start = cur.selBegin().pit();
pit_type end = cur.selEnd().pit() + 1;
- pit_type endpit = setLayout(start, end, layout);
+ setLayout(start, end, layout);
updateCounters();
}
// only to be sure, should not be neccessary
cur.clearSelection();
- cur.buffer().insertStringAsLines(pars_, pit, pos, current_font, str);
+ cur.buffer().insertStringAsLines(pars_, pit, pos, current_font, str,
+ autoBreakRows_);
cur.resetAnchor();
setCursor(cur, cur.pit(), pos);
pit_type LyXText::getPitNearY(int y) const
{
BOOST_ASSERT(!paragraphs().empty());
- BOOST_ASSERT(theCoords.pars_.find(this) != theCoords.pars_.end());
- CoordCache::InnerParPosCache const & cc = theCoords.pars_[this];
+ BOOST_ASSERT(theCoords.getParPos().find(this) != theCoords.getParPos().end());
+ CoordCache::InnerParPosCache const & cc = theCoords.getParPos().find(this)->second;
lyxerr << "LyXText::getPitNearY: y: " << y << " cache size: "
<< cc.size() << endl;
const_cast<LyXText *>(this)->setCurrentFont(cur);
return 0;
}
-
+
// This should be just before or just behind the
// cursor position set above.
BOOST_ASSERT((pos != 0 && inset == pars_[pit].getInset(pos - 1))
} else if (cur.pit() > 0) {
--cur.pit();
setCursor(cur, cur.pit(), x2pos(cur.pit(), cur.paragraph().rows().size() - 1, x));
-
+
}
cur.x_target() = x;
void LyXText::cursorDown(LCursor & cur)
{
-
-
Paragraph const & par = cur.paragraph();
int const row = par.pos2row(cur.pos());
int const x = cur.targetX();
editXY(cur, x, y + par.rows()[row].descent() + 1);
return;
}
-
+
if (row + 1 < int(par.rows().size())) {
setCursor(cur, cur.pit(), x2pos(cur.pit(), row + 1, x));
} else if (cur.pit() + 1 < int(paragraphs().size())) {
++cur.pit();
setCursor(cur, cur.pit(), x2pos(cur.pit(), 0, x));
}
-
+
cur.x_target() = x;
}
if (oldpar.empty() || (oldpar.size() == 1 && oldpar.isLineSeparator(0))) {
// ok, we will delete something
- CursorSlice tmpcursor;
-
deleted = true;
bool selection_position_was_oldcursor_position =