mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
speed up after some profiling
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7413 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
618ad87140
commit
a7dc233a17
@ -286,25 +286,20 @@ void Paragraph::cutIntoMinibuffer(BufferParams const & bparams, pos_type pos)
|
|||||||
minibuffer_char = ' ';
|
minibuffer_char = ' ';
|
||||||
// This reflects what GetInset() does (ARRae)
|
// This reflects what GetInset() does (ARRae)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Erase(pos); now the caller is responsible for that.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool Paragraph::insertFromMinibuffer(pos_type pos)
|
bool Paragraph::insertFromMinibuffer(pos_type pos)
|
||||||
{
|
{
|
||||||
if (minibuffer_char == Paragraph::META_INSET) {
|
if (minibuffer_char == Paragraph::META_INSET) {
|
||||||
if (!insetAllowed(minibuffer_inset->lyxCode())) {
|
if (!insetAllowed(minibuffer_inset->lyxCode()))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
insertInset(pos, minibuffer_inset, minibuffer_font);
|
insertInset(pos, minibuffer_inset, minibuffer_font);
|
||||||
} else {
|
} else {
|
||||||
LyXFont f = minibuffer_font;
|
LyXFont f = minibuffer_font;
|
||||||
if (!checkInsertChar(f)) {
|
if (!checkInsertChar(f))
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
insertChar(pos, minibuffer_char, f);
|
insertChar(pos, minibuffer_char, f);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -341,8 +336,7 @@ bool Paragraph::checkInsertChar(LyXFont & font)
|
|||||||
|
|
||||||
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c)
|
void Paragraph::insertChar(pos_type pos, Paragraph::value_type c)
|
||||||
{
|
{
|
||||||
LyXFont const f(LyXFont::ALL_INHERIT);
|
insertChar(pos, c, LyXFont(LyXFont::ALL_INHERIT));
|
||||||
insertChar(pos, c, f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -355,8 +349,7 @@ void Paragraph::insertChar(pos_type pos, Paragraph::value_type c,
|
|||||||
|
|
||||||
void Paragraph::insertInset(pos_type pos, InsetOld * inset)
|
void Paragraph::insertInset(pos_type pos, InsetOld * inset)
|
||||||
{
|
{
|
||||||
LyXFont const f(LyXFont::ALL_INHERIT);
|
insertInset(pos, inset, LyXFont(LyXFont::ALL_INHERIT));
|
||||||
insertInset(pos, inset, f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -397,22 +390,20 @@ LyXFont const Paragraph::getFontSettings(BufferParams const & bparams,
|
|||||||
|
|
||||||
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
|
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
|
||||||
Pimpl::FontList::const_iterator end = pimpl_->fontlist.end();
|
Pimpl::FontList::const_iterator end = pimpl_->fontlist.end();
|
||||||
for (; cit != end; ++cit) {
|
for (; cit != end; ++cit)
|
||||||
if (cit->pos() >= pos)
|
if (cit->pos() >= pos)
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
LyXFont retfont;
|
|
||||||
if (cit != end)
|
if (cit != end)
|
||||||
retfont = cit->font();
|
return cit->font();
|
||||||
else if (pos == size() && !empty())
|
|
||||||
retfont = getFontSettings(bparams, pos - 1);
|
|
||||||
else
|
|
||||||
retfont = LyXFont(LyXFont::ALL_INHERIT, getParLanguage(bparams));
|
|
||||||
|
|
||||||
return retfont;
|
if (pos == size() && !empty())
|
||||||
|
return getFontSettings(bparams, pos - 1);
|
||||||
|
|
||||||
|
return LyXFont(LyXFont::ALL_INHERIT, getParLanguage(bparams));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lyx::pos_type
|
lyx::pos_type
|
||||||
Paragraph::getEndPosOfFontSpan(lyx::pos_type pos) const
|
Paragraph::getEndPosOfFontSpan(lyx::pos_type pos) const
|
||||||
{
|
{
|
||||||
@ -420,11 +411,12 @@ Paragraph::getEndPosOfFontSpan(lyx::pos_type pos) const
|
|||||||
|
|
||||||
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
|
Pimpl::FontList::const_iterator cit = pimpl_->fontlist.begin();
|
||||||
Pimpl::FontList::const_iterator end = pimpl_->fontlist.end();
|
Pimpl::FontList::const_iterator end = pimpl_->fontlist.end();
|
||||||
for (; cit != end; ++cit) {
|
for (; cit != end; ++cit)
|
||||||
if (cit->pos() >= pos)
|
if (cit->pos() >= pos)
|
||||||
return cit->pos();
|
return cit->pos();
|
||||||
}
|
|
||||||
// This should not happen, but if so, we take no chances.
|
// This should not happen, but if so, we take no chances.
|
||||||
|
lyxerr << "Pararaph::getEndPosOfFontSpan: This should not happen!\n";
|
||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,13 +463,10 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
|
|||||||
LyXFont const Paragraph::getLabelFont(BufferParams const & bparams,
|
LyXFont const Paragraph::getLabelFont(BufferParams const & bparams,
|
||||||
LyXFont const & outerfont) const
|
LyXFont const & outerfont) const
|
||||||
{
|
{
|
||||||
LyXLayout_ptr const & lout = layout();
|
LyXFont tmpfont = layout()->labelfont;
|
||||||
|
|
||||||
LyXFont tmpfont = lout->labelfont;
|
|
||||||
tmpfont.setLanguage(getParLanguage(bparams));
|
tmpfont.setLanguage(getParLanguage(bparams));
|
||||||
tmpfont.realize(outerfont);
|
tmpfont.realize(outerfont);
|
||||||
tmpfont.realize(bparams.getLyXTextClass().defaultfont());
|
tmpfont.realize(bparams.getLyXTextClass().defaultfont());
|
||||||
|
|
||||||
return tmpfont;
|
return tmpfont;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -485,13 +474,10 @@ LyXFont const Paragraph::getLabelFont(BufferParams const & bparams,
|
|||||||
LyXFont const Paragraph::getLayoutFont(BufferParams const & bparams,
|
LyXFont const Paragraph::getLayoutFont(BufferParams const & bparams,
|
||||||
LyXFont const & outerfont) const
|
LyXFont const & outerfont) const
|
||||||
{
|
{
|
||||||
LyXLayout_ptr const & lout = layout();
|
LyXFont tmpfont = layout()->font;
|
||||||
|
|
||||||
LyXFont tmpfont = lout->font;
|
|
||||||
tmpfont.setLanguage(getParLanguage(bparams));
|
tmpfont.setLanguage(getParLanguage(bparams));
|
||||||
tmpfont.realize(outerfont);
|
tmpfont.realize(outerfont);
|
||||||
tmpfont.realize(bparams.getLyXTextClass().defaultfont());
|
tmpfont.realize(bparams.getLyXTextClass().defaultfont());
|
||||||
|
|
||||||
return tmpfont;
|
return tmpfont;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user