remove Buffer * parameter from a bunch of get*Font functions

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7398 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-07-27 21:59:06 +00:00
parent 30964c75af
commit b6f6469040
11 changed files with 105 additions and 137 deletions

View File

@ -14,7 +14,18 @@
2003-07-26 André Pönitz <poenitz@gmx.net>
* lyxtext.h:
* paragraph_func.[Ch]:
* paragraph.C (realizeFont): inline it whereever it is used
* rowpainter.C:
* text.C:
* text2.C:
* text3.C: remove Buffer * parameter from a bunch of get*Font functions
2003-07-26 André Pönitz <poenitz@gmx.net>
* lyxtext.h:
* text.C:
* text2.C: get rid of LyXText::need_break_row

View File

@ -2688,7 +2688,7 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
if (cols < columns) {
InsetText & inset = loctab->getCellInset(cell);
LyXFont const font = inset.getLyXText(bv)->
getFont(bv->buffer(), inset.paragraphs.begin(), 0);
getFont(inset.paragraphs.begin(), 0);
inset.setText(buf.substr(op, p - op), font);
++cols;
++cell;
@ -2699,7 +2699,7 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
if (cols < columns) {
InsetText & inset = tabular.getCellInset(cell);
LyXFont const font = inset.getLyXText(bv)->
getFont(bv->buffer(), inset.paragraphs.begin(), 0);
getFont(inset.paragraphs.begin(), 0);
inset.setText(buf.substr(op, p - op), font);
}
cols = ocol;
@ -2715,7 +2715,7 @@ bool InsetTabular::insertAsciiString(BufferView * bv, string const & buf,
if (cell < cells && op < len) {
InsetText & inset = loctab->getCellInset(cell);
LyXFont const font = inset.getLyXText(bv)->
getFont(bv->buffer(), inset.paragraphs.begin(), 0);
getFont(inset.paragraphs.begin(), 0);
inset.setText(buf.substr(op, len - op), font);
}

View File

@ -1529,7 +1529,8 @@ void InsetText::fitInsetCursor(BufferView * bv) const
the_locking_inset->fitInsetCursor(bv);
return;
}
LyXFont const font = text_.getFont(bv->buffer(), cpar(), cpos());
LyXFont const font = text_.getFont(cpar(), cpos());
int const asc = font_metrics::maxAscent(font);
int const desc = font_metrics::maxDescent(font);
@ -1847,12 +1848,11 @@ void InsetText::setFrameColor(BufferView * bv, LColor::color col)
}
int InsetText::cx(BufferView * bv) const
int InsetText::cx(BufferView *) const
{
int x = text_.cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
if (the_locking_inset) {
LyXFont font = text_.getFont(bv->buffer(), text_.cursor.par(),
text_.cursor.pos());
LyXFont font = text_.getFont(text_.cursor.par(), text_.cursor.pos());
if (font.isVisibleRightToLeft())
x -= the_locking_inset->width();
}
@ -1860,12 +1860,11 @@ int InsetText::cx(BufferView * bv) const
}
int InsetText::cix(BufferView * bv) const
int InsetText::cix(BufferView *) const
{
int x = text_.cursor.ix() + top_x + TEXT_TO_INSET_OFFSET;
if (the_locking_inset) {
LyXFont font = text_.getFont(bv->buffer(), text_.cursor.par(),
text_.cursor.pos());
LyXFont font = text_.getFont(text_.cursor.par(), text_.cursor.pos());
if (font.isVisibleRightToLeft())
x -= the_locking_inset->width();
}

View File

@ -60,6 +60,8 @@ public:
LyXFont current_font;
/// the current font
LyXFont real_current_font;
/// our buffer's default layout font
//LyXFont defaultfont_;
private:
/** the 'anchor' row: the position of this row remains constant
* with respect to the top of the screen
@ -85,16 +87,13 @@ public:
///
int getRealCursorX() const;
///
LyXFont const getFont(Buffer const *, ParagraphList::iterator pit,
lyx::pos_type pos) const;
LyXFont getFont(ParagraphList::iterator pit, lyx::pos_type pos) const;
///
LyXFont const getLayoutFont(Buffer const *,
ParagraphList::iterator pit) const;
LyXFont getLayoutFont(ParagraphList::iterator pit) const;
///
LyXFont const getLabelFont(Buffer const *,
ParagraphList::iterator pit) const;
LyXFont getLabelFont(ParagraphList::iterator pit) const;
///
void setCharFont(Buffer const *, ParagraphList::iterator pit,
void setCharFont(ParagraphList::iterator pit,
lyx::pos_type pos, LyXFont const & font);
void setCharFont(ParagraphList::iterator pit,
lyx::pos_type pos,
@ -420,7 +419,7 @@ private:
float getCursorX(RowList::iterator rit, lyx::pos_type pos,
lyx::pos_type last, bool boundary) const;
/// used in setlayout
void makeFontEntriesLayoutSpecific(Buffer const &, Paragraph & par);
void makeFontEntriesLayoutSpecific(BufferParams const &, Paragraph & par);
/** forces the redrawing of a paragraph. Needed when manipulating a
right address box

View File

@ -462,8 +462,9 @@ LyXFont const Paragraph::getFont(BufferParams const & bparams, pos_type pos,
LyXFont tmpfont = getFontSettings(bparams, pos);
tmpfont.realize(layoutfont);
tmpfont.realize(outerfont);
tmpfont.realize(bparams.getLyXTextClass().defaultfont());
return realizeFont(tmpfont, bparams);
return tmpfont;
}
@ -475,8 +476,9 @@ LyXFont const Paragraph::getLabelFont(BufferParams const & bparams,
LyXFont tmpfont = lout->labelfont;
tmpfont.setLanguage(getParLanguage(bparams));
tmpfont.realize(outerfont);
tmpfont.realize(bparams.getLyXTextClass().defaultfont());
return realizeFont(tmpfont, bparams);
return tmpfont;
}
@ -488,8 +490,9 @@ LyXFont const Paragraph::getLayoutFont(BufferParams const & bparams,
LyXFont tmpfont = lout->font;
tmpfont.setLanguage(getParLanguage(bparams));
tmpfont.realize(outerfont);
tmpfont.realize(bparams.getLyXTextClass().defaultfont());
return realizeFont(tmpfont, bparams);
return tmpfont;
}
@ -1158,15 +1161,10 @@ bool Paragraph::isWord(pos_type pos) const
Language const *
Paragraph::getParLanguage(BufferParams const & bparams) const
{
if (!empty()) {
if (!empty())
return getFirstFontSettings().language();
#warning FIXME we should check the prev par as well (Lgb)
#if 0
} else if (previous_) {
return previous_->getParLanguage(bparams);
#endif
}else
return bparams.language;
return bparams.language;
}

View File

@ -1021,13 +1021,3 @@ LyXFont const outerFont(ParagraphList::iterator pit,
return tmpfont;
}
LyXFont const realizeFont(LyXFont const & font,
BufferParams const & params)
{
LyXTextClass const & tclass = params.getLyXTextClass();
LyXFont tmpfont(font);
tmpfont.realize(tclass.defaultfont());
return tmpfont;
}

View File

@ -71,9 +71,6 @@ void latexParagraphs(Buffer const * buf,
/// read a paragraph from a .lyx file. Returns number of unrecognised tokens
int readParagraph(Buffer & buf, Paragraph & par, LyXLex & lex);
LyXFont const realizeFont(LyXFont const & font,
BufferParams const & params);
LyXFont const outerFont(ParagraphList::iterator pit,
ParagraphList const & plist);

View File

@ -139,7 +139,7 @@ RowPainter::RowPainter(BufferView const & bv, LyXText const & text,
/// "temporary"
LyXFont const RowPainter::getFont(pos_type pos) const
{
return text_.getFont(bv_.buffer(), pit_, pos);
return text_.getFont(pit_, pos);
}
@ -157,7 +157,7 @@ int RowPainter::singleWidth(lyx::pos_type pos, char c) const
LyXFont const RowPainter::getLabelFont() const
{
return text_.getLabelFont(bv_.buffer(), pit_);
return text_.getLabelFont(pit_);
}

View File

@ -284,7 +284,7 @@ int LyXText::singleWidth(ParagraphList::iterator pit,
if (pos >= pit->size())
return 0;
LyXFont const & font = getFont(bv()->buffer(), pit, pos);
LyXFont const & font = getFont(pit, pos);
// The most common case is handled first (Asger)
if (IsPrintable(c)) {
@ -594,7 +594,7 @@ int LyXText::leftMargin(Row const & row) const
}
}
LyXFont const labelfont = getLabelFont(bv()->buffer(), row.par());
LyXFont const labelfont = getLabelFont(row.par());
switch (layout->margintype) {
case MARGIN_DYNAMIC:
if (!layout->leftmargin.empty()) {
@ -819,7 +819,7 @@ pos_type LyXText::rowBreakPoint(Row const & row) const
pos_type i = pos;
// We re-use the font resolution for the entire font span when possible
LyXFont font = getFont(bv()->buffer(), pit, i);
LyXFont font = getFont(pit, i);
lyx::pos_type endPosOfFontSpan = pit->getEndPosOfFontSpan(i);
for (; i < last; ++i) {
@ -834,8 +834,7 @@ pos_type LyXText::rowBreakPoint(Row const & row) const
// add the auto-hfill from label end to the body
if (body_pos && i == body_pos) {
thiswidth = font_metrics::width(layout->labelsep,
getLabelFont(bv()->buffer(), pit));
thiswidth = font_metrics::width(layout->labelsep, getLabelFont(pit));
if (pit->isLineSeparator(i - 1))
thiswidth -= singleWidth(pit, i - 1);
int left_margin = labelEnd(row);
@ -847,7 +846,7 @@ pos_type LyXText::rowBreakPoint(Row const & row) const
if (IsPrintable(c)) {
if (pos > endPosOfFontSpan) {
// We need to get the next font
font = getFont(bv()->buffer(), pit, i);
font = getFont(pit, i);
endPosOfFontSpan = pit->getEndPosOfFontSpan(i);
}
if (! font.language()->RightToLeft()) {
@ -961,11 +960,11 @@ int LyXText::fill(RowList::iterator row, int paper_width) const
if (! pit->empty() && i <= last) {
// We re-use the font resolution for the entire span when possible
LyXFont font = getFont(bv()->buffer(), pit, i);
LyXFont font = getFont(pit, i);
lyx::pos_type endPosOfFontSpan = pit->getEndPosOfFontSpan(i);
while (i <= last) {
if (body_pos > 0 && i == body_pos) {
w += font_metrics::width(layout->labelsep, getLabelFont(bv()->buffer(), pit));
w += font_metrics::width(layout->labelsep, getLabelFont(pit));
if (pit->isLineSeparator(i - 1))
w -= singleWidth(pit, i - 1);
int left_margin = labelEnd(*row);
@ -978,7 +977,7 @@ int LyXText::fill(RowList::iterator row, int paper_width) const
if (IsPrintable(c)) {
if (i > endPosOfFontSpan) {
// We need to get the next font
font = getFont(bv()->buffer(), pit, i);
font = getFont(pit, i);
endPosOfFontSpan = pit->getEndPosOfFontSpan(i);
}
if (! font.language()->RightToLeft()) {
@ -1000,7 +999,7 @@ int LyXText::fill(RowList::iterator row, int paper_width) const
}
}
if (body_pos > 0 && body_pos > last) {
w += font_metrics::width(layout->labelsep, getLabelFont(bv()->buffer(), pit));
w += font_metrics::width(layout->labelsep, getLabelFont(pit));
if (last >= 0 && pit->isLineSeparator(last))
w -= singleWidth(pit, last);
int const left_margin = labelEnd(*row);
@ -1054,7 +1053,7 @@ int LyXText::labelFill(Row const & row) const
int fill = 0;
string const & labwidstr = pit->params().labelWidthString();
if (!labwidstr.empty()) {
LyXFont const labfont = getLabelFont(bv()->buffer(), pit);
LyXFont const labfont = getLabelFont(pit);
int const labwidth = font_metrics::width(labwidstr, labfont);
fill = max(labwidth - w, 0);
}
@ -1095,13 +1094,13 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
// as max get the first character of this row then it can increase but not
// decrease the height. Just some point to start with so we don't have to
// do the assignment below too often.
LyXFont font = getFont(bv()->buffer(), pit, rit->pos());
LyXFont font = getFont(pit, rit->pos());
LyXFont::FONT_SIZE const tmpsize = font.size();
font = getLayoutFont(bv()->buffer(), pit);
font = getLayoutFont(pit);
LyXFont::FONT_SIZE const size = font.size();
font.setSize(tmpsize);
LyXFont labelfont = getLabelFont(bv()->buffer(), pit);
LyXFont labelfont = getLabelFont(pit);
float spacing_val = 1.0;
if (!pit->params().spacing().isDefault()) {
@ -1124,7 +1123,7 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
if (!pit->empty()) {
// We re-use the font resolution for the entire font span when possible
LyXFont font = getFont(bv()->buffer(), pit, rit->pos());
LyXFont font = getFont(pit, rit->pos());
lyx::pos_type endPosOfFontSpan = pit->getEndPosOfFontSpan(rit->pos());
// Optimisation
@ -1138,7 +1137,7 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
if (IsPrintable(c)) {
if (pos > endPosOfFontSpan) {
// We need to get the next font
font = getFont(bv()->buffer(), pit, pos);
font = getFont(pit, pos);
endPosOfFontSpan = par.getEndPosOfFontSpan(pos);
}
if (! font.language()->RightToLeft()) {
@ -1152,7 +1151,7 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
} else {
// Special handling of insets - are any larger?
if (par.isInset(pos)) {
LyXFont const tmpfont = getFont(bv()->buffer(), pit, pos);
LyXFont const tmpfont = getFont(pit, pos);
InsetOld const * tmpinset = par.getInset(pos);
if (tmpinset) {
#if 1 // this is needed for deep update on initialitation
@ -1229,8 +1228,7 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
// there height depends on the font of the nearest character
if (pit->params().lineTop())
maxasc += 2 * font_metrics::ascent('x', getFont(bv()->buffer(),
pit, 0));
maxasc += 2 * font_metrics::ascent('x', getFont(pit, 0));
// and now the pagebreaks
if (pit->params().pagebreakTop())
maxasc += 3 * defaultRowHeight();
@ -1340,9 +1338,7 @@ void LyXText::setHeightOfRow(RowList::iterator rit)
// there height depends on the font of the nearest character
if (pit->params().lineBottom())
maxdesc += 2 * font_metrics::ascent('x',
getFont(bv()->buffer(),
pit,
max(pos_type(0), pit->size() - 1)));
getFont(pit, max(pos_type(0), pit->size() - 1)));
// and now the pagebreaks
if (pit->params().pagebreakBottom())
@ -1668,12 +1664,8 @@ void LyXText::insertChar(char c)
!(contains(number_seperators, c) &&
cursor.pos() >= 1 &&
cursor.pos() < cursor.par()->size() &&
getFont(bv()->buffer(),
cursor.par(),
cursor.pos()).number() == LyXFont::ON &&
getFont(bv()->buffer(),
cursor.par(),
cursor.pos() - 1).number() == LyXFont::ON)
getFont(cursor.par(), cursor.pos()).number() == LyXFont::ON &&
getFont(cursor.par(), cursor.pos() - 1).number() == LyXFont::ON)
)
number(bv()); // Set current_font.number to OFF
} else if (IsDigit(c) &&
@ -1687,16 +1679,16 @@ void LyXText::insertChar(char c)
cursor.par()->isSeparator(cursor.pos() - 2) ||
cursor.par()->isNewline(cursor.pos() - 2))
) {
setCharFont(bv()->buffer(),
setCharFont(
cursor.par(),
cursor.pos() - 1,
current_font);
} else if (contains(number_seperators, c) &&
cursor.pos() >= 2 &&
getFont(bv()->buffer(),
getFont(
cursor.par(),
cursor.pos() - 2).number() == LyXFont::ON) {
setCharFont(bv()->buffer(),
setCharFont(
cursor.par(),
cursor.pos() - 1,
current_font);
@ -1765,7 +1757,7 @@ void LyXText::insertChar(char c)
// Here case LyXText::InsertInset already inserted the character
cursor.par()->insertChar(cursor.pos(), c);
}
setCharFont(bv()->buffer(), cursor.par(), cursor.pos(), rawtmpfont);
setCharFont(cursor.par(), cursor.pos(), rawtmpfont);
if (!jumped_over_space) {
// refresh the positions
@ -2002,9 +1994,7 @@ void LyXText::prepareToPrint(RowList::iterator rit, int & x,
if (body_pos > 0 &&
(body_pos - 1 > last ||
!pit->isLineSeparator(body_pos - 1))) {
x += font_metrics::width(layout->labelsep,
getLabelFont(bv()->buffer(),
pit));
x += font_metrics::width(layout->labelsep, getLabelFont(pit));
if (body_pos - 1 <= last)
x += fill_label_hfill;
}
@ -2177,9 +2167,7 @@ LyXText::selectNextWordToSpellcheck(float & value)
// Start the selection from here
selection.cursor = cursor;
string lang_code(
getFont(bv()->buffer(), cursor.par(), cursor.pos())
.language()->code());
string lang_code = getFont(cursor.par(), cursor.pos()).language()->code();
// and find the end of the word (insets like optional hyphens
// and ligature break are part of a word)
while (cursor.pos() < cursor.par()->size()
@ -2545,8 +2533,7 @@ void LyXText::backspace()
if (cursor.pos() < cursor.par()->size()
&& !cursor.par()->isSeparator(cursor.pos())) {
cursor.par()->insertChar(cursor.pos(), ' ');
setCharFont(bv()->buffer(), cursor.par(),
cursor.pos(), current_font);
setCharFont(cursor.par(), cursor.pos(), current_font);
// refresh the positions
tmprow = row;
while (boost::next(tmprow) != rows().end() &&

View File

@ -92,7 +92,7 @@ void LyXText::init(BufferView * bview)
ParagraphList::iterator pit = ownerParagraphs().begin();
ParagraphList::iterator end = ownerParagraphs().end();
current_font = getFont(bview->buffer(), pit, 0);
current_font = getFont(pit, 0);
for (; pit != end; ++pit)
insertParagraph(pit, rowlist_.end());
@ -111,24 +111,25 @@ void LyXText::init(BufferView * bview)
// smaller. (Asger)
// If position is -1, we get the layout font of the paragraph.
// If position is -2, we get the font of the manual label of the paragraph.
LyXFont const LyXText::getFont(Buffer const * buf, ParagraphList::iterator pit,
pos_type pos) const
LyXFont LyXText::getFont(ParagraphList::iterator pit, pos_type pos) const
{
Assert(pos >= 0);
LyXLayout_ptr const & layout = pit->layout();
#warning broken?
BufferParams const & params = bv()->buffer()->params;
// We specialize the 95% common case:
if (!pit->getDepth()) {
if (layout->labeltype == LABEL_MANUAL
&& pos < pit->beginningOfBody()) {
// 1% goes here
LyXFont f = pit->getFontSettings(buf->params, pos);
LyXFont f = pit->getFontSettings(params, pos);
if (pit->inInset())
pit->inInset()->getDrawFont(f);
return f.realize(layout->reslabelfont);
} else {
LyXFont f = pit->getFontSettings(buf->params, pos);
LyXFont f = pit->getFontSettings(params, pos);
if (pit->inInset())
pit->inInset()->getDrawFont(f);
return f.realize(layout->resfont);
@ -147,7 +148,7 @@ LyXFont const LyXText::getFont(Buffer const * buf, ParagraphList::iterator pit,
layoutfont = layout->font;
}
LyXFont tmpfont = pit->getFontSettings(buf->params, pos);
LyXFont tmpfont = pit->getFontSettings(params, pos);
tmpfont.realize(layoutfont);
if (pit->inInset())
@ -155,13 +156,13 @@ LyXFont const LyXText::getFont(Buffer const * buf, ParagraphList::iterator pit,
// Realize with the fonts of lesser depth.
tmpfont.realize(outerFont(pit, ownerParagraphs()));
//tmpfont.realize(defaultfont_);
return realizeFont(tmpfont, buf->params);
return tmpfont;
}
LyXFont const LyXText::getLayoutFont(Buffer const * buf,
ParagraphList::iterator pit) const
LyXFont LyXText::getLayoutFont(ParagraphList::iterator pit) const
{
LyXLayout_ptr const & layout = pit->layout();
@ -169,16 +170,16 @@ LyXFont const LyXText::getLayoutFont(Buffer const * buf,
return layout->resfont;
}
LyXFont font(layout->font);
LyXFont font = layout->font;
// Realize with the fonts of lesser depth.
font.realize(outerFont(pit, ownerParagraphs()));
//font.realize(defaultfont_);
return realizeFont(font, buf->params);
return font;
}
LyXFont const LyXText::getLabelFont(Buffer const * buf,
ParagraphList::iterator pit) const
LyXFont LyXText::getLabelFont(ParagraphList::iterator pit) const
{
LyXLayout_ptr const & layout = pit->layout();
@ -186,11 +187,12 @@ LyXFont const LyXText::getLabelFont(Buffer const * buf,
return layout->reslabelfont;
}
LyXFont font(layout->labelfont);
LyXFont font = layout->labelfont;
// Realize with the fonts of lesser depth.
font.realize(outerFont(pit, ownerParagraphs()));
//font.realize(defaultfont_);
return realizeFont(layout->labelfont, buf->params);
return font;
}
@ -198,30 +200,27 @@ void LyXText::setCharFont(ParagraphList::iterator pit,
pos_type pos, LyXFont const & fnt,
bool toggleall)
{
Buffer const * buf = bv()->buffer();
LyXFont font = getFont(buf, pit, pos);
font.update(fnt, buf->params.language, toggleall);
BufferParams const & params = bv()->buffer()->params;
LyXFont font = getFont(pit, pos);
font.update(fnt, params.language, toggleall);
// Let the insets convert their font
if (pit->isInset(pos)) {
InsetOld * inset = pit->getInset(pos);
if (isEditableInset(inset)) {
UpdatableInset * uinset =
static_cast<UpdatableInset *>(inset);
uinset->setFont(bv(), fnt, toggleall, true);
static_cast<UpdatableInset *>(inset)
->setFont(bv(), fnt, toggleall, true);
}
}
// Plug thru to version below:
setCharFont(buf, pit, pos, font);
// Plug through to version below:
setCharFont(pit, pos, font);
}
void LyXText::setCharFont(Buffer const * buf, ParagraphList::iterator pit,
pos_type pos, LyXFont const & fnt)
void LyXText::setCharFont(
ParagraphList::iterator pit, pos_type pos, LyXFont const & fnt)
{
LyXFont font(fnt);
LyXTextClass const & tclass = buf->params.getLyXTextClass();
LyXFont font = fnt;
LyXLayout_ptr const & layout = pit->layout();
// Get concrete layout font to reduce against
@ -244,7 +243,7 @@ void LyXText::setCharFont(Buffer const * buf, ParagraphList::iterator pit,
}
}
layoutfont.realize(tclass.defaultfont());
//layoutfont.realize(defaultfont_);
// Now, reduce font against full layout font
font.reduce(layoutfont);
@ -343,7 +342,7 @@ void LyXText::toggleInset()
/* used in setlayout */
// Asger is not sure we want to do this...
void LyXText::makeFontEntriesLayoutSpecific(Buffer const & buf,
void LyXText::makeFontEntriesLayoutSpecific(BufferParams const & params,
Paragraph & par)
{
LyXLayout_ptr const & layout = par.layout();
@ -356,7 +355,7 @@ void LyXText::makeFontEntriesLayoutSpecific(Buffer const & buf,
else
layoutfont = layout->font;
LyXFont tmpfont = par.getFontSettings(buf.params, pos);
LyXFont tmpfont = par.getFontSettings(params, pos);
tmpfont.reduce(layoutfont);
par.setFont(pos, tmpfont);
}
@ -395,7 +394,7 @@ LyXText::setLayout(LyXCursor & cur, LyXCursor & sstart_cur,
do {
pit->applyLayout(lyxlayout);
makeFontEntriesLayoutSpecific(*bv()->buffer(), *pit);
makeFontEntriesLayoutSpecific(bv()->buffer()->params, *pit);
ParagraphList::iterator fppit = pit;
fppit->params().spaceTop(lyxlayout->fill_top ?
VSpace(VSpace::VFILL)
@ -551,11 +550,9 @@ void LyXText::setFont(LyXFont const & font, bool toggleall)
// Determine basis font
LyXFont layoutfont;
if (cursor.pos() < cursor.par()->beginningOfBody()) {
layoutfont = getLabelFont(bv()->buffer(),
cursor.par());
layoutfont = getLabelFont(cursor.par());
} else {
layoutfont = getLayoutFont(bv()->buffer(),
cursor.par());
layoutfont = getLayoutFont(cursor.par());
}
// Update current font
real_current_font.update(font,
@ -1615,8 +1612,7 @@ float LyXText::getCursorX(RowList::iterator rit,
if (body_pos > 0 && pos == body_pos - 1) {
x += fill_label_hfill +
font_metrics::width(
rit_par->layout()->labelsep,
getLabelFont(bv()->buffer(), rit_par));
rit_par->layout()->labelsep, getLabelFont(rit_par));
if (rit_par->isLineSeparator(body_pos - 1))
x -= singleWidth(rit_par, body_pos - 1);
}
@ -1695,9 +1691,8 @@ void LyXText::setCurrentFont()
}
}
current_font =
pit->getFontSettings(bv()->buffer()->params, pos);
real_current_font = getFont(bv()->buffer(), pit, pos);
current_font = pit->getFontSettings(bv()->buffer()->params, pos);
real_current_font = getFont(pit, pos);
if (cursor.pos() == pit->size() &&
isBoundary(bv()->buffer(), *pit, cursor.pos()) &&
@ -1752,8 +1747,7 @@ LyXText::getColumnNearX(RowList::iterator rit, int & x, bool & boundary) const
last_tmpx = tmpx;
if (body_pos > 0 && c == body_pos - 1) {
tmpx += fill_label_hfill +
font_metrics::width(layout->labelsep,
getLabelFont(bv()->buffer(), rit_par));
font_metrics::width(layout->labelsep, getLabelFont(rit_par));
if (rit_par->isLineSeparator(body_pos - 1))
tmpx -= singleWidth(rit_par, body_pos - 1);
}

View File

@ -114,7 +114,7 @@ namespace {
// get inset dimensions
Assert(par->getInset(pos));
LyXFont const & font = text.getFont(bv->buffer(), par, pos);
LyXFont const & font = text.getFont(par, pos);
int const width = inset->width();
int const inset_x = font.isVisibleRightToLeft()
@ -249,11 +249,8 @@ void LyXText::cursorPrevious()
int y = top_y();
if (cursorRow() == rows().begin()) {
if (y > 0) {
int new_y = bv()->text->top_y() - bv()->workHeight();
//bv()->screen().draw(bv()->text, bv(), new_y < 0 ? 0 : new_y);
if (y > 0)
bv()->updateScrollbar();
}
return;
}
@ -270,9 +267,6 @@ void LyXText::cursorPrevious()
return;
// This is what we used to do, so we wouldn't skip right past
// tall rows, but it's not working right now.
#if 0
new_y = bv->text->top_y() - bv->workHeight();
#endif
} else {
if (inset_owner) {
new_y = bv()->text->cursor.iy()
@ -1296,8 +1290,7 @@ InsetOld::RESULT LyXText::dispatch(FuncRequest const & cmd)
if (bv->theLockingInset()) {
InsetOld * tli = bv->theLockingInset();
LyXCursor cursor = bv->text->cursor;
LyXFont font = bv->text->getFont(bv->buffer(),
cursor.par(), cursor.pos());
LyXFont font = bv->text->getFont(cursor.par(), cursor.pos());
int width = tli->width();
int inset_x = font.isVisibleRightToLeft()
? cursor.ix() - width : cursor.ix();