cursor().clearSelection();
text()->breakParagraph(cursor());
- bool res = buffer()->readFile(fname, text()->cursorPar());
+ BOOST_ASSERT(cursor().inTexted());
+ LyXText * text = cursor().text();
+ bool res = buffer()->readFile(fname, text->getPar(cursor().par()));
resize();
return res;
}
{
if (i >= saved_positions_num)
return;
+ BOOST_ASSERT(bv_->cursor().inTexted());
saved_positions[i] = Position(buffer_->fileName(),
- bv_->text()->cursorPar()->id(),
- bv_->text()->cursor().pos());
+ bv_->cursor().paragraph().id(),
+ bv_->cursor().pos());
if (i > 0)
owner_->message(bformat(_("Saved bookmark %1$s"), tostr(i)));
}
PosIterator::PosIterator(BufferView & bv)
{
- LyXText * text = bv.getLyXText();
- lyx::pos_type pos = text->cursor().pos();
- ParagraphList::iterator pit = text->cursorPar();
+ LCursor & cur = bv.cursor();
+ BOOST_ASSERT(cur.inTexted());
+ LyXText * text = cur.text();
+ lyx::pos_type pos = cur.pos();
+ ParagraphList::iterator pit = text->getPar(cur.par());
ParIterator par = bv.buffer()->par_iterator_begin();
ParIterator end = bv.buffer()->par_iterator_end();
/// Returns whether something would be changed by changeDepth
bool changeDepthAllowed(LCursor & cur, bv_funcs::DEPTH_CHANGE type);
- /// get the depth at current cursor position
- int getDepth() const;
-
/// Set font over selection paragraphs and rebreak.
void setFont(LCursor & cur, LyXFont const &, bool toggleall = false);
ParagraphList::iterator getPar(par_type par) const;
///
int parOffset(ParagraphList::iterator pit) const;
- /// # FIXME: should not be used
- ParagraphList::iterator cursorPar() const;
// Returns the current font and depth as a message.
std::string LyXText::currentState(LCursor & cur);
///
int cursorY(CursorSlice const & cursor) const;
- /// the current cursor slice
- CursorSlice & cursor();
- /// the current cursor slice
- CursorSlice const & cursor() const;
-
+ ///
friend class LyXScreen;
///
from = cur.selBegin();
to = cur.selEnd();
} else {
- from = cursor();
+ from = cur.top();
getWord(from, to, lyx::PARTIAL_WORD);
setCursor(cur, to.par(), to.pos() + 1);
}
}
-ParagraphList::iterator LyXText::cursorPar() const
-{
- //lyxerr << "### cursorPar: cursor: " << bv()->cursor() << endl;
- //lyxerr << "xxx cursorPar: cursor: " << cursor() << endl;
- return getPar(cursor().par());
-}
-
-
ParagraphList::iterator LyXText::getPar(CursorSlice const & cur) const
{
return getPar(cur.par());
}
-int LyXText::getDepth() const
-{
- return cursorPar()->getDepth();
-}
-
-
RowList::iterator LyXText::firstRow() const
{
return paragraphs().front().rows.begin();
}
-CursorSlice & LyXText::cursor()
-{
- //lyxerr << "# accessing slice " << findText(this) << endl;
- if (this != bv()->cursor().text()) {
- lyxerr << "cursor: " << bv()->cursor()
- << "\ntext: " << bv()->cursor().text()
- << "\nthis: " << this << endl;
- BOOST_ASSERT(false);
- }
- return bv()->cursor().top();
-}
-
-
-CursorSlice const & LyXText::cursor() const
-{
- if (this != bv()->cursor().text()) {
- lyxerr << "cursor: " << bv()->cursor()
- << "\ntext: " << bv()->cursor().text()
- << "\nthis: " << this << endl;
- BOOST_ASSERT(false);
- }
- return bv()->cursor().top();
-}
-
-
void LyXText::replaceSelection(LCursor & cur)
{
BOOST_ASSERT(this == cur.text());
// os << bformat(_("Font: %1$s"), font.stateText(&buffer->params));
// The paragraph depth
- int depth = getDepth();
+ int depth = cur.paragraph().getDepth();
if (depth > 0)
os << bformat(_(", Depth: %1$s"), tostr(depth));
{
ParagraphList::iterator pit = getPar(cur.par());
ParagraphList::iterator endpit = boost::next(pit);
- pos_type pos = cursor().pos();
+ pos_type pos = cur.pos();
recordUndo(cur);
// only to be sure, should not be neccessary
cur.par() = 0;
cur.pos() = 0;
if (!gotoNextInset(cur, codes, contents)) {
- cursor() = tmp;
+ cur.top() = tmp;
cur.message(_("No more insets"));
}
} else {