Variables of type pit_type should be named pit, not par

It is easier to use always the same conventions for naming.
This commit is contained in:
Jean-Marc Lasgouttes 2016-02-29 13:29:06 +01:00 committed by Richard Heck
parent 83d8e12cc1
commit 0437d8dc1a
4 changed files with 30 additions and 30 deletions

View File

@ -100,11 +100,11 @@ bool checkPastePossible(int index)
struct PasteReturnValue { struct PasteReturnValue {
PasteReturnValue(pit_type r_par, pos_type r_pos, bool r_nu) : PasteReturnValue(pit_type r_pit, pos_type r_pos, bool r_nu) :
par(r_par), pos(r_pos), needupdate(r_nu) pit(r_pit), pos(r_pos), needupdate(r_nu)
{} {}
pit_type par; pit_type pit;
pos_type pos; pos_type pos;
bool needupdate; bool needupdate;
}; };
@ -1074,7 +1074,7 @@ void pasteParagraphList(Cursor & cur, ParagraphList const & parlist,
pasteSelectionHelper(cur, parlist, docclass, 0, errorList); pasteSelectionHelper(cur, parlist, docclass, 0, errorList);
cur.forceBufferUpdate(); cur.forceBufferUpdate();
cur.clearSelection(); cur.clearSelection();
text->setCursor(cur, prv.par, prv.pos); text->setCursor(cur, prv.pit, prv.pos);
} }
// mathed is handled in InsetMathNest/InsetMathGrid // mathed is handled in InsetMathNest/InsetMathGrid

View File

@ -109,12 +109,12 @@ static bool moveItem(Paragraph & fromPar, pos_type fromPos,
void breakParagraphConservative(BufferParams const & bparams, void breakParagraphConservative(BufferParams const & bparams,
ParagraphList & pars, pit_type par_offset, pos_type pos) ParagraphList & pars, pit_type pit, pos_type pos)
{ {
// create a new paragraph // create a new paragraph
Paragraph & tmp = *pars.insert(lyx::next(pars.begin(), par_offset + 1), Paragraph & tmp = *pars.insert(lyx::next(pars.begin(), pit + 1),
Paragraph()); Paragraph());
Paragraph & par = pars[par_offset]; Paragraph & par = pars[pit];
tmp.setInsetOwner(&par.inInset()); tmp.setInsetOwner(&par.inInset());
tmp.makeSameLayout(par); tmp.makeSameLayout(par);

View File

@ -182,12 +182,12 @@ public:
void rejectChanges(); void rejectChanges();
/// returns true if par was empty and was removed /// returns true if par was empty and was removed
bool setCursor(Cursor & cur, pit_type par, pos_type pos, bool setCursor(Cursor & cur, pit_type pit, pos_type pos,
bool setfont = true, bool boundary = false); bool setfont = true, bool boundary = false);
/// ///
void setCursor(CursorSlice &, pit_type par, pos_type pos); void setCursor(CursorSlice &, pit_type pit, pos_type pos);
/// ///
void setCursorIntern(Cursor & cur, pit_type par, void setCursorIntern(Cursor & cur, pit_type pit,
pos_type pos, bool setfont = true, bool boundary = false); pos_type pos, bool setfont = true, bool boundary = false);
/// Move cursor one position backwards /// Move cursor one position backwards
@ -322,20 +322,20 @@ public:
docstring completionPrefix(Cursor const & cur) const; docstring completionPrefix(Cursor const & cur) const;
/// find a paragraph before \p par with the given \p depth, if such /// find a paragraph before \p par with the given \p depth, if such
/// a paragraph cannot be found, \p par is returned /// a paragraph cannot be found, \p par is returned
pit_type depthHook(pit_type par, depth_type depth) const; pit_type depthHook(pit_type pit, depth_type depth) const;
/// find a paragraph before \p par with depth less than the /// find a paragraph before \p par with depth less than the
/// depth of \p par. If such paragraph cannot be found because /// depth of \p par. If such paragraph cannot be found because
/// \p par already has depth 0, lastpar + 1 is returned. If /// \p par already has depth 0, lastpar + 1 is returned. If
/// such paragraph cannot be found because there isn't a par /// such paragraph cannot be found because there isn't a par
/// with less depth before this one, \p par is returned. /// with less depth before this one, \p par is returned.
pit_type outerHook(pit_type par) const; pit_type outerHook(pit_type pit) const;
/// Is it the first par with same depth and layout? /// Is it the first par with same depth and layout?
bool isFirstInSequence(pit_type par) const; bool isFirstInSequence(pit_type pit) const;
/// Is this paragraph in the table of contents? /// Is this paragraph in the table of contents?
int getTocLevel(pit_type par) const; int getTocLevel(pit_type pit) const;
/// Get the font of the "environment" of paragraph \p par_offset in \p pars. /// Get the font of the "environment" of paragraph \p par_offset in \p pars.
/// All font changes of the paragraph are relative to this font. /// All font changes of the paragraph are relative to this font.
Font const outerFont(pit_type par_offset) const; Font const outerFont(pit_type pit_offset) const;
private: private:
/// The InsetText owner shall have access to everything. /// The InsetText owner shall have access to everything.
@ -383,7 +383,7 @@ private:
/// ///
void breakParagraphConservative(BufferParams const & bparams, void breakParagraphConservative(BufferParams const & bparams,
ParagraphList & paragraphs, ParagraphList & paragraphs,
pit_type par, pit_type pit,
pos_type pos); pos_type pos);
/** /**
@ -391,7 +391,7 @@ void breakParagraphConservative(BufferParams const & bparams,
* Be careful, this doesent make any check at all. * Be careful, this doesent make any check at all.
*/ */
void mergeParagraph(BufferParams const & bparams, void mergeParagraph(BufferParams const & bparams,
ParagraphList & paragraphs, pit_type par); ParagraphList & paragraphs, pit_type pit);
/// accept the changes within the complete ParagraphList /// accept the changes within the complete ParagraphList
void acceptChanges(ParagraphList & pars, BufferParams const & bparams); void acceptChanges(ParagraphList & pars, BufferParams const & bparams);

View File

@ -547,25 +547,25 @@ void Text::insertInset(Cursor & cur, Inset * inset)
} }
bool Text::setCursor(Cursor & cur, pit_type par, pos_type pos, bool Text::setCursor(Cursor & cur, pit_type pit, pos_type pos,
bool setfont, bool boundary) bool setfont, bool boundary)
{ {
TextMetrics const & tm = cur.bv().textMetrics(this); TextMetrics const & tm = cur.bv().textMetrics(this);
bool const update_needed = !tm.contains(par); bool const update_needed = !tm.contains(pit);
Cursor old = cur; Cursor old = cur;
setCursorIntern(cur, par, pos, setfont, boundary); setCursorIntern(cur, pit, pos, setfont, boundary);
return cur.bv().checkDepm(cur, old) || update_needed; return cur.bv().checkDepm(cur, old) || update_needed;
} }
void Text::setCursor(CursorSlice & cur, pit_type par, pos_type pos) void Text::setCursor(CursorSlice & cur, pit_type pit, pos_type pos)
{ {
LASSERT(par != int(paragraphs().size()), return); LASSERT(pit != int(paragraphs().size()), return);
cur.pit() = par; cur.pit() = pit;
cur.pos() = pos; cur.pos() = pos;
// now some strict checking // now some strict checking
Paragraph & para = getPar(par); Paragraph const & par = getPar(pit);
// None of these should happen, but we're scaredy-cats // None of these should happen, but we're scaredy-cats
if (pos < 0) { if (pos < 0) {
@ -573,21 +573,21 @@ void Text::setCursor(CursorSlice & cur, pit_type par, pos_type pos)
LATTEST(false); LATTEST(false);
} }
if (pos > para.size()) { if (pos > par.size()) {
LYXERR0("Don't like 1, pos: " << pos LYXERR0("Don't like 1, pos: " << pos
<< " size: " << para.size() << " size: " << par.size()
<< " par: " << par); << " par: " << pit);
LATTEST(false); LATTEST(false);
} }
} }
void Text::setCursorIntern(Cursor & cur, void Text::setCursorIntern(Cursor & cur, pit_type pit, pos_type pos,
pit_type par, pos_type pos, bool setfont, bool boundary) bool setfont, bool boundary)
{ {
LBUFERR(this == cur.text()); LBUFERR(this == cur.text());
cur.boundary(boundary); cur.boundary(boundary);
setCursor(cur.top(), par, pos); setCursor(cur.top(), pit, pos);
if (setfont) if (setfont)
cur.setCurrentFont(); cur.setCurrentFont();
} }