* LyXText::singleWidth(): remove unneeded Buffer argument.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15627 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2006-10-30 20:10:35 +00:00
parent e61e83ec20
commit 27ef7c726f
3 changed files with 12 additions and 14 deletions

View File

@ -276,8 +276,8 @@ public:
int singleWidth(Buffer const &, Paragraph const & par, int singleWidth(Buffer const &, Paragraph const & par,
pos_type pos) const; pos_type pos) const;
/// ///
int singleWidth(Buffer const &, Paragraph const & par, int singleWidth(Paragraph const & par, pos_type pos, char_type c,
pos_type pos, char_type c, LyXFont const & Font) const; LyXFont const & Font) const;
/// return the color of the canvas /// return the color of the canvas
LColor_color backgroundColor() const; LColor_color backgroundColor() const;

View File

@ -202,8 +202,7 @@ void RowPainter::paintHebrewComposeChar(pos_type & vpos, LyXFont const & font)
c = par_.getChar(i); c = par_.getChar(i);
if (!Encodings::isComposeChar_hebrew(c)) { if (!Encodings::isComposeChar_hebrew(c)) {
if (isPrintableNonspace(c)) { if (isPrintableNonspace(c)) {
int const width2 = int const width2 = text_.singleWidth(par_, i, c,
text_.singleWidth(*bv_.buffer(), par_, i, c,
text_.getFont(*bv_.buffer(), par_, i)); text_.getFont(*bv_.buffer(), par_, i));
// FIXME UNICODE // FIXME UNICODE
// This does not work anymore, and non-ascii // This does not work anymore, and non-ascii
@ -242,8 +241,7 @@ void RowPainter::paintArabicComposeChar(pos_type & vpos, LyXFont const & font)
c = par_.getChar(i); c = par_.getChar(i);
if (!Encodings::isComposeChar_arabic(c)) { if (!Encodings::isComposeChar_arabic(c)) {
if (isPrintableNonspace(c)) { if (isPrintableNonspace(c)) {
int const width2 = int const width2 = text_.singleWidth(par_, i, c,
text_.singleWidth(*bv_.buffer(), par_, i, c,
text_.getFont(*bv_.buffer(), par_, i)); text_.getFont(*bv_.buffer(), par_, i));
dx = (width2 - width) / 2; dx = (width2 - width) / 2;
} }
@ -668,8 +666,8 @@ void RowPainter::paintText()
font = text_.getFont(buffer, par_, vpos); font = text_.getFont(buffer, par_, vpos);
} }
const int width_pos = text_.singleWidth(buffer, par_, pos, const int width_pos =
par_.getChar(pos), font); text_.singleWidth(par_, pos, par_.getChar(pos), font);
if (x_ + width_pos < 0) { if (x_ + width_pos < 0) {
x_ += width_pos; x_ += width_pos;

View File

@ -427,12 +427,12 @@ int LyXText::height() const
int LyXText::singleWidth(Buffer const & buffer, Paragraph const & par, int LyXText::singleWidth(Buffer const & buffer, Paragraph const & par,
pos_type pos) const pos_type pos) const
{ {
return singleWidth(buffer, par, pos, par.getChar(pos), return singleWidth(par, pos, par.getChar(pos),
getFont(buffer, par, pos)); getFont(buffer, par, pos));
} }
int LyXText::singleWidth(Buffer const & buffer, Paragraph const & par, int LyXText::singleWidth(Paragraph const & par,
pos_type pos, char_type c, LyXFont const & font) const pos_type pos, char_type c, LyXFont const & font) const
{ {
// The most common case is handled first (Asger) // The most common case is handled first (Asger)
@ -742,7 +742,7 @@ void LyXText::rowBreakPoint(Buffer const & buffer, pit_type const pit,
FontMetrics const & fm = theFontMetrics(getLabelFont(buffer, par)); FontMetrics const & fm = theFontMetrics(getLabelFont(buffer, par));
for ( ; i < end; ++i, ++fi) { for ( ; i < end; ++i, ++fi) {
char_type const c = par.getChar(i); char_type const c = par.getChar(i);
int thiswidth = singleWidth(buffer, par, i, c, *fi); int thiswidth = singleWidth(par, i, c, *fi);
// add the auto-hfill from label end to the body // add the auto-hfill from label end to the body
if (body_pos && i == body_pos) { if (body_pos && i == body_pos) {
@ -838,7 +838,7 @@ void LyXText::setRowWidth(Buffer const & buffer, pit_type const pit, Row & row)
w = max(w, labelEnd(buffer, pit)); w = max(w, labelEnd(buffer, pit));
} }
char_type const c = par.getChar(i); char_type const c = par.getChar(i);
w += singleWidth(buffer, par, i, c, *fi); w += singleWidth(par, i, c, *fi);
} }
} }
@ -2328,7 +2328,7 @@ int LyXText::cursorX(Buffer const & buffer, CursorSlice const & sl,
font = getFont(buffer, par, pos); font = getFont(buffer, par, pos);
} }
x += singleWidth(buffer, par, pos, par.getChar(pos), font); x += singleWidth(par, pos, par.getChar(pos), font);
if (par.hfillExpansion(row, pos)) if (par.hfillExpansion(row, pos))
x += (pos >= body_pos) ? m.hfill : m.label_hfill; x += (pos >= body_pos) ? m.hfill : m.label_hfill;