Cleanup: Replace a bunch of Cursor arguments with DocIterators.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@30951 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2009-08-09 16:49:41 +00:00
parent bc9488004e
commit f35561d055
5 changed files with 18 additions and 17 deletions

View File

@ -2447,9 +2447,9 @@ void BufferView::insertPlaintextFile(FileName const & f, bool asParagraph)
cap::replaceSelection(cur); cap::replaceSelection(cur);
buffer_.undo().recordUndo(cur); buffer_.undo().recordUndo(cur);
if (asParagraph) if (asParagraph)
cur.innerText()->insertStringAsParagraphs(cur, tmpstr); cur.innerText()->insertStringAsParagraphs(cur, tmpstr, cur.current_font);
else else
cur.innerText()->insertStringAsLines(cur, tmpstr); cur.innerText()->insertStringAsLines(cur, tmpstr, cur.current_font);
updateMetrics(); updateMetrics();
buffer_.changed(); buffer_.changed();

View File

@ -941,9 +941,9 @@ void pasteClipboardText(Cursor & cur, ErrorList & errorList, bool asParagraphs)
return; return;
cur.recordUndo(); cur.recordUndo();
if (asParagraphs) if (asParagraphs)
cur.text()->insertStringAsParagraphs(cur, text); cur.text()->insertStringAsParagraphs(cur, text, cur.current_font);
else else
cur.text()->insertStringAsLines(cur, text); cur.text()->insertStringAsLines(cur, text, cur.current_font);
} }

View File

@ -252,11 +252,11 @@ public:
/* these things are for search and replace */ /* these things are for search and replace */
/// needed to insert the selection /// needed to insert the selection
/// FIXME: replace Cursor with DocIterator. void insertStringAsLines(DocIterator const & dit, docstring const & str,
void insertStringAsLines(Cursor & cur, docstring const & str); Font const & font);
/// needed to insert the selection /// needed to insert the selection
/// FIXME: replace Cursor with DocIterator. void insertStringAsParagraphs(DocIterator const & dit, docstring const & str,
void insertStringAsParagraphs(Cursor & cur, docstring const & str); Font const & font);
/// access to our paragraphs /// access to our paragraphs
ParagraphList const & paragraphs() const { return pars_; } ParagraphList const & paragraphs() const { return pars_; }

View File

@ -503,12 +503,12 @@ void Text::insertInset(Cursor & cur, Inset * inset)
// needed to insert the selection // needed to insert the selection
void Text::insertStringAsLines(Cursor & cur, docstring const & str) void Text::insertStringAsLines(DocIterator const & dit, docstring const & str,
Font const & font)
{ {
BufferParams const & bparams = owner_->buffer().params(); BufferParams const & bparams = owner_->buffer().params();
pit_type pit = cur.pit(); pit_type pit = dit.pit();
pos_type pos = cur.pos(); pos_type pos = dit.pos();
Font font = cur.current_font;
// insert the string, don't insert doublespace // insert the string, don't insert doublespace
bool space_inserted = true; bool space_inserted = true;
@ -555,7 +555,8 @@ void Text::insertStringAsLines(Cursor & cur, docstring const & str)
// turn double CR to single CR, others are converted into one // turn double CR to single CR, others are converted into one
// blank. Then insertStringAsLines is called // blank. Then insertStringAsLines is called
void Text::insertStringAsParagraphs(Cursor & cur, docstring const & str) void Text::insertStringAsParagraphs(DocIterator const & dit, docstring const & str,
Font const & font)
{ {
docstring linestr = str; docstring linestr = str;
bool newline_inserted = false; bool newline_inserted = false;
@ -576,7 +577,7 @@ void Text::insertStringAsParagraphs(Cursor & cur, docstring const & str)
newline_inserted = false; newline_inserted = false;
} }
} }
insertStringAsLines(cur, linestr); insertStringAsLines(dit, linestr, font);
} }

View File

@ -245,7 +245,7 @@ static bool doInsertInset(Cursor & cur, Text * text,
if (edit) if (edit)
inset->edit(cur, true); inset->edit(cur, true);
// Now put this into inset // Now put this into inset
cur.text()->insertStringAsLines(cur, ds); cur.text()->insertStringAsLines(cur, ds, cur.current_font);
cur.leaveInset(*inset); cur.leaveInset(*inset);
return true; return true;
} }
@ -2779,9 +2779,9 @@ void Text::pasteString(Cursor & cur, docstring const & clip,
if (!clip.empty()) { if (!clip.empty()) {
cur.recordUndo(); cur.recordUndo();
if (asParagraphs) if (asParagraphs)
insertStringAsParagraphs(cur, clip); insertStringAsParagraphs(cur, clip, cur.current_font);
else else
insertStringAsLines(cur, clip); insertStringAsLines(cur, clip, cur.current_font);
} }
} }