Few more update text-inset issues + some fixes, see ChangeLog.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@859 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Vigna 2000-07-05 14:57:48 +00:00
parent b51e368b2b
commit 666140b7f2
36 changed files with 297 additions and 254 deletions

View File

@ -1,3 +1,14 @@
2000-07-05 Juergen Vigna <jug@sad.it>
* src/insets/lyxinset.h: changed Painter & in ascent(), descent()
calls to BufferView *.
* src/insets/insettext.C (checkAndActivateInset): small fix non
HIGHLY_EDITABLE insets should not be entered by cursor-move-over!
* src/insets/insetcommand.C (Read): Fixed as insets should read till
their \end_inset token!
2000-07-04 edscott <edscott@imp.mx>
* src/lyxrc.C, src/lyxrc.h, src/BufferView_pimpl.C,

View File

@ -45,7 +45,7 @@ extern BufferList bufferlist;
extern char ascii_type;
extern void sigchldhandler(pid_t pid, int * status);
extern int bibitemMaxWidth(Painter &, LyXFont const &);
extern int bibitemMaxWidth(BufferView *, LyXFont const &);
static inline
@ -861,10 +861,9 @@ void BufferView::Pimpl::workAreaButtonRelease(int x, int y,
// Maybe we want to edit a bibitem ale970302
if (bv_->text->cursor.par()->bibkey && x < 20 +
bibitemMaxWidth(bv_->painter(),
textclasslist
.TextClass(buffer_->
params.textclass).defaultfont())) {
bibitemMaxWidth(bv_, textclasslist.
TextClass(buffer_->
params.textclass).defaultfont())) {
bv_->text->cursor.par()->bibkey->Edit(bv_, 0, 0, 0);
}
@ -904,16 +903,16 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
int start_x, end_x;
if (is_rtl) {
start_x = cursor.x() - tmpinset->width(bv_->painter(), font);
start_x = cursor.x() - tmpinset->width(bv_, font);
end_x = cursor.x();
} else {
start_x = cursor.x();
end_x = cursor.x() + tmpinset->width(bv_->painter(), font);
end_x = cursor.x() + tmpinset->width(bv_, font);
}
if (x > start_x && x < end_x
&& y_tmp > cursor.y() - tmpinset->ascent(bv_->painter(), font)
&& y_tmp < cursor.y() + tmpinset->descent(bv_->painter(), font)) {
&& y_tmp > cursor.y() - tmpinset->ascent(bv_, font)
&& y_tmp < cursor.y() + tmpinset->descent(bv_, font)) {
#if 0
if (move_cursor && (tmpinset != bv_->the_locking_inset))
#endif
@ -936,15 +935,15 @@ Inset * BufferView::Pimpl::checkInsetHit(LyXText * text, int & x, int & y,
int start_x, end_x;
if (!is_rtl) {
start_x = cursor.x() - tmpinset->width(bv_->painter(), font);
start_x = cursor.x() - tmpinset->width(bv_, font);
end_x = cursor.x();
} else {
start_x = cursor.x();
end_x = cursor.x() + tmpinset->width(bv_->painter(), font);
end_x = cursor.x() + tmpinset->width(bv_, font);
}
if (x > start_x && x < end_x
&& y_tmp > cursor.y() - tmpinset->ascent(bv_->painter(), font)
&& y_tmp < cursor.y() + tmpinset->descent(bv_->painter(), font)) {
&& y_tmp > cursor.y() - tmpinset->ascent(bv_, font)
&& y_tmp < cursor.y() + tmpinset->descent(bv_, font)) {
#if 0
if (move_cursor && (tmpinset != bv_->the_locking_inset))
#endif

View File

@ -1016,19 +1016,19 @@ InsetFig::~InsetFig()
}
int InsetFig::ascent(Painter &, LyXFont const &) const
int InsetFig::ascent(BufferView *, LyXFont const &) const
{
return hgh + 3;
}
int InsetFig::descent(Painter &, LyXFont const &) const
int InsetFig::descent(BufferView *, LyXFont const &) const
{
return 1;
}
int InsetFig::width(Painter &, LyXFont const &) const
int InsetFig::width(BufferView *, LyXFont const &) const
{
return wid + 2;
}
@ -1085,7 +1085,7 @@ void InsetFig::draw(BufferView * bv, LyXFont const & f,
font.setSize(LyXFont::SIZE_TINY);
pain.text(int(x + 8), baseline - 4, msg, strlen(msg), font);
}
x += width(pain, font); // ?
x += width(bv, font); // ?
}

View File

@ -24,11 +24,11 @@ public:
///
~InsetFig();
///
int ascent(Painter &, LyXFont const & font) const;
int ascent(BufferView *, LyXFont const & font) const;
///
int descent(Painter &, LyXFont const & font) const;
int descent(BufferView *, LyXFont const & font) const;
///
int width(Painter &, LyXFont const & font) const;
int width(BufferView *, LyXFont const & font) const;
///
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
///

View File

@ -132,7 +132,7 @@ void UpdatableInset::Edit(BufferView * bv, int, int, unsigned int)
scx = 0;
mx_scx = abs((width(bv->painter(), font) - bv->workWidth()) / 2);
mx_scx = abs((width(bv, font) - bv->workWidth()) / 2);
}

View File

@ -366,7 +366,7 @@ bool InsetBibtex::delDatabase(string const & db)
// ale070405 This function maybe shouldn't be here. We'll fix this at 0.13.
int bibitemMaxWidth(Painter & pain, LyXFont const & font)
int bibitemMaxWidth(BufferView * bv, LyXFont const & font)
{
int w = 0;
// Does look like a hack? It is! (but will change at 0.13)
@ -374,7 +374,7 @@ int bibitemMaxWidth(Painter & pain, LyXFont const & font)
while (par) {
if (par->bibkey) {
int wx = par->bibkey->width(pain, font);
int wx = par->bibkey->width(bv, font);
if (wx > w) w = wx;
}
par = par->next;
@ -384,7 +384,7 @@ int bibitemMaxWidth(Painter & pain, LyXFont const & font)
// ale070405
string bibitemWidest(Painter & pain)
string bibitemWidest(BufferView * bv)
{
int w = 0;
// Does look like a hack? It is! (but will change at 0.13)
@ -394,7 +394,7 @@ string bibitemWidest(Painter & pain)
while (par) {
if (par->bibkey) {
int wx = par->bibkey->width(pain, font);
int wx = par->bibkey->width(bv, font);
if (wx > w) {
w = wx;
bkey = par->bibkey;

View File

@ -27,7 +27,7 @@ InsetButton::InsetButton()
{
}
int InsetButton::ascent(Painter & pain, LyXFont const &) const
int InsetButton::ascent(BufferView * bv, LyXFont const &) const
{
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
@ -36,18 +36,18 @@ int InsetButton::ascent(Painter & pain, LyXFont const &) const
string s = getScreenLabel();
if (Editable()) {
pain.buttonText(0, 0, s, font,
false, width, ascent, descent);
bv->painter().buttonText(0, 0, s, font,
false, width, ascent, descent);
} else {
pain.rectText(0, 0, s, font,
LColor::commandbg, LColor::commandframe,
false, width, ascent, descent);
bv->painter().rectText(0, 0, s, font,
LColor::commandbg, LColor::commandframe,
false, width, ascent, descent);
}
return ascent;
}
int InsetButton::descent(Painter & pain, LyXFont const &) const
int InsetButton::descent(BufferView * bv, LyXFont const &) const
{
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
@ -56,18 +56,18 @@ int InsetButton::descent(Painter & pain, LyXFont const &) const
string s = getScreenLabel();
if (Editable()) {
pain.buttonText(0, 0, s, font,
false, width, ascent, descent);
bv->painter().buttonText(0, 0, s, font,
false, width, ascent, descent);
} else {
pain.rectText(0, 0, s, font,
LColor::commandbg, LColor::commandframe,
false, width, ascent, descent);
bv->painter().rectText(0, 0, s, font,
LColor::commandbg, LColor::commandframe,
false, width, ascent, descent);
}
return descent;
}
int InsetButton::width(Painter & pain, LyXFont const &) const
int InsetButton::width(BufferView * bv, LyXFont const &) const
{
LyXFont font(LyXFont::ALL_SANE);
font.decSize();
@ -76,12 +76,12 @@ int InsetButton::width(Painter & pain, LyXFont const &) const
string s = getScreenLabel();
if (Editable()) {
pain.buttonText(0, 0, s, font,
false, width, ascent, descent);
bv->painter().buttonText(0, 0, s, font,
false, width, ascent, descent);
} else {
pain.rectText(0, 0, s, font,
LColor::commandbg, LColor::commandframe,
false, width, ascent, descent);
bv->painter().rectText(0, 0, s, font,
LColor::commandbg, LColor::commandframe,
false, width, ascent, descent);
}
return width + 4;
}

View File

@ -27,11 +27,11 @@ public:
InsetButton();
///
int ascent(Painter &, LyXFont const &) const;
int ascent(BufferView *, LyXFont const &) const;
///
int descent(Painter &, LyXFont const &) const;
int descent(BufferView *, LyXFont const &) const;
///
int width(Painter &, LyXFont const &) const;
int width(BufferView *, LyXFont const &) const;
///
void draw(BufferView *, LyXFont const &, int, float &, bool) const;

View File

@ -27,6 +27,7 @@
class LyXText;
using std::ostream;
using std::endl;
InsetCollapsable::InsetCollapsable()
: UpdatableInset()
@ -79,9 +80,11 @@ void InsetCollapsable::Write(Buffer const * buf, ostream & os) const
void InsetCollapsable::Read(Buffer const * buf, LyXLex & lex)
{
string token;
if (lex.IsOK()) {
lex.next();
string token = lex.GetString();
token = lex.GetString();
if (token == "collapsed") {
lex.next();
collapsed = lex.GetBool();
@ -118,30 +121,30 @@ int InsetCollapsable::width_collapsed(Painter & pain, LyXFont const &) const
}
int InsetCollapsable::ascent(Painter & pain, LyXFont const & font) const
int InsetCollapsable::ascent(BufferView * bv, LyXFont const & font) const
{
if (collapsed)
return ascent_collapsed(pain, font);
return ascent_collapsed(bv->painter(), font);
else
return inset->ascent(pain, font) + TEXT_TO_TOP_OFFSET;
return inset->ascent(bv, font) + TEXT_TO_TOP_OFFSET;
}
int InsetCollapsable::descent(Painter & pain, LyXFont const & font) const
int InsetCollapsable::descent(BufferView * bv, LyXFont const & font) const
{
if (collapsed)
return descent_collapsed(pain, font);
return descent_collapsed(bv->painter(), font);
else
return inset->descent(pain, font) + TEXT_TO_BOTTOM_OFFSET;
return inset->descent(bv, font) + TEXT_TO_BOTTOM_OFFSET;
}
int InsetCollapsable::width(Painter & pain, LyXFont const & font) const
int InsetCollapsable::width(BufferView * bv, LyXFont const & font) const
{
if (collapsed)
return widthCollapsed;
return inset->width(pain, font) + widthCollapsed;
return inset->width(bv, font) + widthCollapsed;
}
@ -170,11 +173,12 @@ void InsetCollapsable::draw(BufferView * bv, LyXFont const & f,
}
if (!cleared && ((inset->need_update == InsetText::FULL) ||
(inset->need_update == InsetText::INIT) ||
(top_x!=int(x)) || (top_baseline!=baseline))) {
int w = owner()? width(pain, f) : pain.paperWidth();
int h = ascent(pain,f) + descent(pain, f);
int w = owner()? width(bv, f) : pain.paperWidth();
int h = ascent(bv,f) + descent(bv, f);
int tx = (needFullRow() && !owner())? 0:int(x);
int ty = baseline - ascent(pain,f);
int ty = baseline - ascent(bv,f);
if (ty < 0)
ty = 0;
@ -285,24 +289,25 @@ int InsetCollapsable::getMaxWidth(Painter & pain,
UpdatableInset const * inset) const
{
int w;
if (owner())
w = static_cast<UpdatableInset*>(owner())->getMaxWidth(pain,inset);
else
w = pain.paperWidth();
w = UpdatableInset::getMaxWidth(pain,inset);
if (w < 0)
if (w < 0) {
return w;
}
w -= widthCollapsed;
// should be at least 30 pixels !!!
if (w < 30)
w = 30;
return w; // - top_x - widthCollapsed;
}
#if 0
int InsetCollapsable::getMaxTextWidth(Painter & pain,
UpdatableInset const * inset) const
{
return getMaxWidth(pain, inset) - widthCollapsed;
}
#endif
void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
bool dodraw)
@ -316,8 +321,8 @@ void InsetCollapsable::update(BufferView * bv, LyXFont const & font,
return;
}
}
if (oldWidth != width(bv->painter(), font)) {
oldWidth = width(bv->painter(), font);
if (oldWidth != width(bv, font)) {
oldWidth = width(bv, font);
inset->deleteLyXText(bv);
need_update = FULL;
if (owner()) {

View File

@ -49,11 +49,11 @@ public:
///
void Write(Buffer const *, std::ostream &) const;
///
int ascent(Painter &, LyXFont const &) const;
int ascent(BufferView *, LyXFont const &) const;
///
int descent(Painter &, LyXFont const &) const;
int descent(BufferView *, LyXFont const &) const;
///
int width(Painter &, LyXFont const & f) const;
int width(BufferView *, LyXFont const & f) const;
///
void draw(BufferView *, const LyXFont &, int , float &, bool) const;
///

View File

@ -107,11 +107,23 @@ void InsetCommand::scanCommand(string const & cmd)
// This function will not be necessary when lyx3
void InsetCommand::Read(Buffer const *, LyXLex & lex)
{
string token;
if (lex.EatLine()) {
string t = lex.GetString();
scanCommand(t);
token = lex.GetString();
scanCommand(token);
} else
lex.printError("InsetCommand: Parse error: `$$Token'");
while (lex.IsOK()) {
lex.nextToken();
token = lex.GetString();
if (token == "\\end_inset")
break;
}
if (token != "\\end_inset") {
lex.printError("Missing \\end_inset at this point. "
"Read: `$$Token'");
}
}

View File

@ -48,7 +48,7 @@ InsetError::~InsetError()
}
int InsetError::ascent(Painter &, LyXFont const & font) const
int InsetError::ascent(BufferView *, LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
@ -56,7 +56,7 @@ int InsetError::ascent(Painter &, LyXFont const & font) const
}
int InsetError::descent(Painter &, LyXFont const & font) const
int InsetError::descent(BufferView *, LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
@ -64,7 +64,7 @@ int InsetError::descent(Painter &, LyXFont const & font) const
}
int InsetError::width(Painter &, LyXFont const & font) const
int InsetError::width(BufferView *, LyXFont const & font) const
{
LyXFont efont;
efont.setSize(font.size()).decSize();
@ -82,17 +82,17 @@ void InsetError::draw(BufferView * bv, LyXFont const & font,
// Draw as "Error" in a framed box
x += 1;
pain.fillRectangle(int(x), baseline - ascent(pain, font) + 1,
width(pain, font) - 2,
ascent(pain, font) + descent(pain, font) - 2,
pain.fillRectangle(int(x), baseline - ascent(bv, font) + 1,
width(bv, font) - 2,
ascent(bv, font) + descent(bv, font) - 2,
LColor::insetbg);
pain.rectangle(int(x), baseline - ascent(pain, font) + 1,
width(pain, font) - 2,
ascent(pain, font) + descent(pain, font) - 2,
pain.rectangle(int(x), baseline - ascent(bv, font) + 1,
width(bv, font) - 2,
ascent(bv, font) + descent(bv, font) - 2,
LColor::error);
pain.text(int(x + 2), baseline, _("Error"), efont);
x += width(pain, font) - 1;
x += width(bv, font) - 1;
}

View File

@ -36,11 +36,11 @@ public:
///
~InsetError();
///
int ascent(Painter &, LyXFont const & font) const;
int ascent(BufferView *, LyXFont const & font) const;
///
int descent(Painter &, LyXFont const & font) const;
int descent(BufferView *, LyXFont const & font) const;
///
int width(Painter &, LyXFont const & font) const;
int width(BufferView *, LyXFont const & font) const;
///
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
///

View File

@ -111,21 +111,21 @@ InsetGraphics::InsetGraphics()
{}
int InsetGraphics::ascent(Painter &, LyXFont const &) const
int InsetGraphics::ascent(BufferView *, LyXFont const &) const
{
return 100;
}
int InsetGraphics::descent(Painter &, LyXFont const &) const
int InsetGraphics::descent(BufferView *, LyXFont const &) const
{
// this is not true if viewport is used and clip is not.
return 1;
}
int InsetGraphics::width(Painter &, LyXFont const &) const
int InsetGraphics::width(BufferView *, LyXFont const &) const
{
if (bb.isSet()) {
return bb.urx - bb.llx;
@ -141,9 +141,9 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
// This will draw the graphics. As for now we only draw a
// placeholder rectangele.
pain.rectangle(int(x), baseline - ascent(pain, font),
width(pain, font),
ascent(pain, font) + descent(pain, font));
pain.rectangle(int(x), baseline - ascent(bv, font),
width(bv, font),
ascent(bv, font) + descent(bv, font));
}

View File

@ -29,11 +29,11 @@ public:
///
InsetGraphics();
///
int ascent(Painter &, LyXFont const &) const;
int ascent(BufferView *, LyXFont const &) const;
///
int descent(Painter &, LyXFont const &) const;
int descent(BufferView *, LyXFont const &) const;
///
int width(Painter &, LyXFont const &) const;
int width(BufferView *, LyXFont const &) const;
///
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
///

View File

@ -57,19 +57,19 @@ InsetInfo::~InsetInfo()
}
int InsetInfo::ascent(Painter &, LyXFont const & font) const
int InsetInfo::ascent(BufferView *, LyXFont const & font) const
{
return lyxfont::maxAscent(font) + 1;
}
int InsetInfo::descent(Painter &, LyXFont const & font) const
int InsetInfo::descent(BufferView *, LyXFont const & font) const
{
return lyxfont::maxDescent(font) + 1;
}
int InsetInfo::width(Painter &, LyXFont const & font) const
int InsetInfo::width(BufferView *, LyXFont const & font) const
{
return 6 + lyxfont::width(_("Note"), font);
}
@ -86,17 +86,17 @@ void InsetInfo::draw(BufferView * bv, LyXFont const & f,
// Draw as "Note" in a yellow box
x += 1;
pain.fillRectangle(int(x), baseline - ascent(pain, font) + 1,
width(pain, font) - 2,
ascent(pain, font) + descent(pain, font) - 2,
pain.fillRectangle(int(x), baseline - ascent(bv, font) + 1,
width(bv, font) - 2,
ascent(bv, font) + descent(bv, font) - 2,
LColor::notebg);
pain.rectangle(int(x), baseline - ascent(pain, font) + 1,
width(pain, font) - 2,
ascent(pain, font) + descent(pain, font) - 2,
pain.rectangle(int(x), baseline - ascent(bv, font) + 1,
width(bv, font) - 2,
ascent(bv, font) + descent(bv, font) - 2,
LColor::noteframe);
pain.text(int(x + 2), baseline, _("Note"), font);
x += width(pain, font) - 1;
x += width(bv, font) - 1;
}

View File

@ -38,11 +38,11 @@ public:
///
~InsetInfo();
///
int ascent(Painter &, LyXFont const &) const;
int ascent(BufferView *, LyXFont const &) const;
///
int descent(Painter &, LyXFont const &) const;
int descent(BufferView *, LyXFont const &) const;
///
int width(Painter &, LyXFont const &) const;
int width(BufferView *, LyXFont const &) const;
///
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
///

View File

@ -255,7 +255,7 @@ void InsetLatexAccent::checkContents()
}
int InsetLatexAccent::ascent(Painter &, LyXFont const & font) const
int InsetLatexAccent::ascent(BufferView *, LyXFont const & font) const
{
// This function is a bit too simplistix and is just a
// "try to make a fit for all accents" approach, to
@ -275,7 +275,7 @@ int InsetLatexAccent::ascent(Painter &, LyXFont const & font) const
}
int InsetLatexAccent::descent(Painter &, LyXFont const & font) const
int InsetLatexAccent::descent(BufferView *, LyXFont const & font) const
{
int max;
if (candisp) {
@ -291,7 +291,7 @@ int InsetLatexAccent::descent(Painter &, LyXFont const & font) const
}
int InsetLatexAccent::width(Painter &, LyXFont const & font) const
int InsetLatexAccent::width(BufferView *, LyXFont const & font) const
{
if (candisp)
return lyxfont::width(ic, font);
@ -312,7 +312,7 @@ int InsetLatexAccent::Rbearing(LyXFont const & font) const
}
bool InsetLatexAccent::DisplayISO8859_9(Painter & pain, LyXFont const & font,
bool InsetLatexAccent::DisplayISO8859_9(BufferView * bv, LyXFont const & font,
int baseline,
float & x) const
{
@ -346,8 +346,8 @@ bool InsetLatexAccent::DisplayISO8859_9(Painter & pain, LyXFont const & font,
}
if (tmpic != ic) {
char ch = char(tmpic);
pain.text(int(x), baseline, ch, font);
x += width(pain, font);
bv->painter().text(int(x), baseline, ch, font);
x += width(bv, font);
return true;
}
else
@ -361,7 +361,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font,
Painter & pain = bv->painter();
if (lyxrc.font_norm == "iso8859-9")
if (DisplayISO8859_9(pain, font, baseline, x))
if (DisplayISO8859_9(bv, font, baseline, x))
return;
/* draw it! */
@ -370,9 +370,9 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font,
// should also be considered.
if (candisp) {
int asc = ascent(pain, font);
int desc = descent(pain, font);
int wid = width(pain, font);
int asc = ascent(bv, font);
int desc = descent(bv, font);
int wid = width(bv, font);
float x2 = x + (Rbearing(font) - Lbearing(font)) / 2.0;
float hg;
int y;
@ -412,7 +412,7 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font,
// closer to the top of the dot-less 'i' or 'j'.
char tmpic = ic; // store the ic when we
ic = 'x'; // calculates the ascent of
asc = ascent(pain, font); // the dot-less version (here: 'x')
asc = ascent(bv, font); // the dot-less version (here: 'x')
ic = tmpic; // set the orig ic back
y = baseline - asc; // update to new y coord.
}
@ -595,16 +595,16 @@ void InsetLatexAccent::draw(BufferView * bv, LyXFont const & font,
}
} else {
pain.fillRectangle(int(x + 1),
baseline - ascent(pain, font) + 1,
width(pain, font) - 2,
ascent(pain, font)
+ descent(pain, font) - 2);
pain.rectangle(int(x + 1), baseline - ascent(pain, font) + 1,
width(pain, font) - 2,
ascent(pain, font) + descent(pain, font) - 2);
baseline - ascent(bv, font) + 1,
width(bv, font) - 2,
ascent(bv, font)
+ descent(bv, font) - 2);
pain.rectangle(int(x + 1), baseline - ascent(bv, font) + 1,
width(bv, font) - 2,
ascent(bv, font) + descent(bv, font) - 2);
pain.text(int(x + 2), baseline, contents, font);
}
x += width(pain, font);
x += width(bv, font);
}

View File

@ -35,11 +35,11 @@ public:
explicit
InsetLatexAccent(string const & string);
///
int ascent(Painter &, LyXFont const &) const;
int ascent(BufferView *, LyXFont const &) const;
///
int descent(Painter &, LyXFont const &) const;
int descent(BufferView *, LyXFont const &) const;
///
int width(Painter &, LyXFont const &) const;
int width(BufferView *, LyXFont const &) const;
///
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
///
@ -47,7 +47,7 @@ public:
///
int Rbearing(LyXFont const & font) const;
///
bool DisplayISO8859_9(Painter &, LyXFont const & font,
bool DisplayISO8859_9(BufferView *, LyXFont const & font,
int baseline, float & x) const;
///
void Write(Buffer const *, std::ostream &) const;

View File

@ -159,19 +159,19 @@ string InsetQuotes::DispString() const
}
int InsetQuotes::ascent(Painter &, LyXFont const & font) const
int InsetQuotes::ascent(BufferView *, LyXFont const & font) const
{
return lyxfont::maxAscent(font);
}
int InsetQuotes::descent(Painter &, LyXFont const & font) const
int InsetQuotes::descent(BufferView *, LyXFont const & font) const
{
return lyxfont::maxDescent(font);
}
int InsetQuotes::width(Painter &, LyXFont const & font) const
int InsetQuotes::width(BufferView *, LyXFont const & font) const
{
string text = DispString();
int w = 0;
@ -203,7 +203,7 @@ void InsetQuotes::draw(BufferView * bv, LyXFont const & font,
string text = DispString();
bv->painter().text(int(x), baseline, text, font);
x += width(bv->painter(), font);
x += width(bv, font);
}

View File

@ -72,11 +72,11 @@ public:
InsetQuotes(char c, BufferParams const & params);
///
int ascent(Painter &, LyXFont const &) const;
int ascent(BufferView *, LyXFont const &) const;
///
int descent(Painter &, LyXFont const &) const;
int descent(BufferView *, LyXFont const &) const;
///
int width(Painter &, LyXFont const &) const;
int width(BufferView *, LyXFont const &) const;
///
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
///

View File

@ -28,19 +28,19 @@ InsetSpecialChar::InsetSpecialChar(Kind k)
{}
int InsetSpecialChar::ascent(Painter &, LyXFont const & font) const
int InsetSpecialChar::ascent(BufferView *, LyXFont const & font) const
{
return lyxfont::maxAscent(font);
}
int InsetSpecialChar::descent(Painter &, LyXFont const & font) const
int InsetSpecialChar::descent(BufferView *, LyXFont const & font) const
{
return lyxfont::maxDescent(font);
}
int InsetSpecialChar::width(Painter &, LyXFont const & font) const
int InsetSpecialChar::width(BufferView *, LyXFont const & font) const
{
switch (kind) {
case HYPHENATION:
@ -83,21 +83,21 @@ void InsetSpecialChar::draw(BufferView * bv, LyXFont const & f,
{
font.setColor(LColor::special);
pain.text(int(x), baseline, "-", font);
x += width(pain, font);
x += width(bv, font);
break;
}
case END_OF_SENTENCE:
{
font.setColor(LColor::special);
pain.text(int(x), baseline, ".", font);
x += width(pain, font);
x += width(bv, font);
break;
}
case LDOTS:
{
font.setColor(LColor::special);
pain.text(int(x), baseline, ". . .", font);
x += width(pain, font);
x += width(bv, font);
break;
}
case MENU_SEPARATOR:
@ -114,12 +114,12 @@ void InsetSpecialChar::draw(BufferView * bv, LyXFont const & f,
xp[3] = ox; yp[3] = baseline;
pain.lines(xp, yp, 4, LColor::special);
x += width(pain, font);
x += width(bv, font);
break;
}
case PROTECTED_SEPARATOR:
{
float w = width(pain, font);
float w = width(bv, font);
int h = lyxfont::ascent('x', font);
int xp[4], yp[4];

View File

@ -44,11 +44,11 @@ public:
explicit
InsetSpecialChar(Kind k);
///
int ascent(Painter &, LyXFont const &) const;
int ascent(BufferView *, LyXFont const &) const;
///
int descent(Painter &, LyXFont const &) const;
int descent(BufferView *, LyXFont const &) const;
///
int width(Painter &, LyXFont const &) const;
int width(BufferView *, LyXFont const &) const;
///
void draw(BufferView *, LyXFont const &, int, float &, bool) const;
///

View File

@ -131,19 +131,19 @@ void InsetTabular::Read(Buffer const * buf, LyXLex & lex)
}
int InsetTabular::ascent(Painter &, LyXFont const &) const
int InsetTabular::ascent(BufferView *, LyXFont const &) const
{
return tabular->GetAscentOfRow(0);
}
int InsetTabular::descent(Painter &, LyXFont const &) const
int InsetTabular::descent(BufferView *, LyXFont const &) const
{
return tabular->GetHeightOfTabular() - tabular->GetAscentOfRow(0);
}
int InsetTabular::width(Painter &, LyXFont const &) const
int InsetTabular::width(BufferView *, LyXFont const &) const
{
return tabular->GetWidthOfTabular() + (2 * ADD_TO_TABULAR_WIDTH);
}
@ -161,10 +161,10 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
if (!cleared && ((need_update == INIT) || (need_update == FULL) ||
(top_x != int(x)) || (top_baseline != baseline))) {
#if 1
int h = ascent(pain, font) + descent(pain, font);
int h = ascent(bv, font) + descent(bv, font);
int tx = display()? 0:top_x;
int w = tx? width(pain, font):pain.paperWidth();
int ty = baseline - ascent(pain, font);
int w = tx? width(bv, font):pain.paperWidth();
int ty = baseline - ascent(bv, font);
if (ty < 0)
ty = 0;
@ -221,7 +221,7 @@ void InsetTabular::draw(BufferView * bv, LyXFont const & font, int baseline,
tabular->GetAdditionalHeight(cell+1);
}
}
x += width(pain, font);
x += width(bv, font);
need_update = NONE;
}
@ -329,7 +329,7 @@ void InsetTabular::Edit(BufferView * bv, int x, int y, unsigned int button)
locked = true;
the_locking_inset = 0;
inset_pos = inset_x = inset_y = 0;
setPos(bv->painter(), x, y);
setPos(bv, x, y);
sel_pos_start = sel_pos_end = cursor.pos();
sel_cell_start = sel_cell_end = actcell;
bv->text->FinishUndo();
@ -365,7 +365,7 @@ void InsetTabular::UpdateLocal(BufferView * bv, UpdateCodes what,
need_update = what;
bv->updateInset(this, mark_dirty);
if (what != NONE)
resetPos(bv->painter());
resetPos(bv);
}
bool InsetTabular::LockInsetInInset(BufferView * bv, UpdatableInset * inset)
@ -377,7 +377,7 @@ bool InsetTabular::LockInsetInInset(BufferView * bv, UpdatableInset * inset)
if (inset == tabular->GetCellInset(actcell)) {
lyxerr[Debug::INSETS] << "OK" << endl;
the_locking_inset = tabular->GetCellInset(actcell);
resetPos(bv->painter());
resetPos(bv);
inset_x = cursor.x() - top_x + tabular->GetBeginningOfTextInCell(actcell);
inset_y = cursor.y();
inset_pos = cursor.pos();
@ -385,7 +385,7 @@ bool InsetTabular::LockInsetInInset(BufferView * bv, UpdatableInset * inset)
} else if (the_locking_inset && (the_locking_inset == inset)) {
if (cursor.pos() == inset_pos) {
lyxerr[Debug::INSETS] << "OK" << endl;
resetPos(bv->painter());
resetPos(bv);
inset_x = cursor.x() - top_x + tabular->GetBeginningOfTextInCell(actcell);
inset_y = cursor.y();
} else {
@ -500,7 +500,7 @@ void InsetTabular::InsetButtonPress(BufferView * bv, int x, int y, int button)
int ocell = actcell;
setPos(bv->painter(), x, y);
setPos(bv, x, y);
sel_pos_start = sel_pos_end = cursor.pos();
sel_cell_start = sel_cell_end = actcell;
@ -538,7 +538,7 @@ void InsetTabular::InsetMotionNotify(BufferView * bv, int x, int y, int button)
// int ocell = actcell,
int old = sel_pos_end;
setPos(bv->painter(), x, y);
setPos(bv, x, y);
sel_pos_end = cursor.pos();
sel_cell_end = actcell;
if (old != sel_pos_end)
@ -571,7 +571,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
if (((result=UpdatableInset::LocalDispatch(bv, action, arg)) == DISPATCHED)
|| (result == DISPATCHED_NOUPDATE)) {
resetPos(bv->painter());
resetPos(bv);
return result;
}
result=DISPATCHED;
@ -594,7 +594,7 @@ UpdatableInset::RESULT InsetTabular::LocalDispatch(BufferView * bv, int action,
} else if (result == FINISHED) {
if ((action == LFUN_RIGHT) || (action == -1)) {
cursor.pos(inset_pos + 1);
resetPos(bv->painter());
resetPos(bv);
}
sel_pos_start = sel_pos_end = cursor.pos();
sel_cell_start = sel_cell_end = actcell;
@ -786,9 +786,9 @@ bool InsetTabular::calculate_dimensions_of_cells(BufferView * bv,
++cell;
inset = tabular->GetCellInset(cell);
inset->update(bv, font, dodraw);
maxAsc = max(maxAsc, inset->ascent(bv->painter(), font));
maxDesc = max(maxDesc, inset->descent(bv->painter(), font));
changed = tabular->SetWidthOfCell(cell, inset->width(bv->painter(), font)) || changed;
maxAsc = max(maxAsc, inset->ascent(bv, font));
maxDesc = max(maxDesc, inset->descent(bv, font));
changed = tabular->SetWidthOfCell(cell, inset->width(bv, font)) || changed;
}
changed = tabular->SetAscentOfRow(i, maxAsc + ADD_TO_HEIGHT) || changed;
changed = tabular->SetDescentOfRow(i, maxDesc + ADD_TO_HEIGHT) || changed;
@ -845,7 +845,7 @@ void InsetTabular::HideInsetCursor(BufferView * bv)
}
void InsetTabular::setPos(Painter & pain, int x, int y) const
void InsetTabular::setPos(BufferView * bv, int x, int y) const
{
cursor.y(0);
cursor.pos(0);
@ -871,14 +871,14 @@ void InsetTabular::setPos(Painter & pain, int x, int y) const
++actcell,lx += tabular->GetWidthOfColumn(actcell) +
tabular->GetAdditionalWidth(actcell - 1));
cursor.pos(((actcell+1) * 2) - 1);
resetPos(pain);
resetPos(bv);
if ((lx - (tabular->GetWidthOfColumn(actcell)/2)) < x) {
cursor.x(lx + top_x - 2);
} else {
cursor.pos(cursor.pos() - 1);
cursor.x(lx - tabular->GetWidthOfColumn(actcell) + top_x + 2);
}
resetPos(pain);
resetPos(bv);
}
int InsetTabular::getCellXPos(int cell) const
@ -895,7 +895,7 @@ int InsetTabular::getCellXPos(int cell) const
ADD_TO_TABULAR_WIDTH);
}
void InsetTabular::resetPos(Painter & pain) const
void InsetTabular::resetPos(BufferView * bv) const
{
if (!locked)
return;
@ -915,7 +915,7 @@ void InsetTabular::resetPos(Painter & pain) const
cursor.x(getCellXPos(actcell) + 2);
if (cursor.pos() % 2) {
LyXFont font(LyXFont::ALL_SANE);
cursor.x(cursor.x() + tabular->GetCellInset(actcell)->width(pain,font) +
cursor.x(cursor.x() + tabular->GetCellInset(actcell)->width(bv,font) +
tabular->GetBeginningOfTextInCell(actcell));
}
if ((!the_locking_inset ||
@ -940,7 +940,7 @@ UpdatableInset::RESULT InsetTabular::moveRight(BufferView * bv, bool lock)
} else { // before the inset
cursor.pos(cursor.pos() + 1);
}
resetPos(bv->painter());
resetPos(bv);
return DISPATCHED_NOUPDATE;
}
@ -959,7 +959,7 @@ UpdatableInset::RESULT InsetTabular::moveLeft(BufferView * bv, bool lock)
if (ActivateCellInset(bv, 0, 0, 0, true))
return DISPATCHED;
}
resetPos(bv->painter());
resetPos(bv);
return DISPATCHED_NOUPDATE;
}
@ -970,7 +970,7 @@ UpdatableInset::RESULT InsetTabular::moveUp(BufferView * bv)
actcell = tabular->GetCellAbove(actcell);
if (actcell == ocell) // we moved out of the inset
return FINISHED;
resetPos(bv->painter());
resetPos(bv);
return DISPATCHED_NOUPDATE;
}
@ -981,7 +981,7 @@ UpdatableInset::RESULT InsetTabular::moveDown(BufferView * bv)
actcell = tabular->GetCellBelow(actcell);
if (actcell == ocell) // we moved out of the inset
return FINISHED;
resetPos(bv->painter());
resetPos(bv);
return DISPATCHED_NOUPDATE;
}
@ -994,7 +994,7 @@ bool InsetTabular::moveNextCell(BufferView * bv)
cursor.pos(cursor.pos() + 1);
if (!cellstart(cursor.pos()))
cursor.pos(cursor.pos() + 1);
resetPos(bv->painter());
resetPos(bv);
return true;
}
@ -1007,7 +1007,7 @@ bool InsetTabular::movePrevCell(BufferView * bv)
cursor.pos(cursor.pos() - 1);
if (cellstart(cursor.pos()))
cursor.pos(cursor.pos() - 1);
resetPos(bv->painter());
resetPos(bv);
return true;
}
@ -1271,14 +1271,14 @@ bool InsetTabular::ActivateCellInset(BufferView * bv, int x, int y, int button,
// reset the curor pos first!
if (cursor.pos() % 2) { // behind the inset
cursor.pos(cursor.pos() - 1);
resetPos(bv->painter());
resetPos(bv);
}
UpdatableInset * inset =
static_cast<UpdatableInset*>(tabular->GetCellInset(actcell));
LyXFont font(LyXFont::ALL_SANE);
if (behind) {
x = inset->x() + inset->width(bv->painter(), font);
y = inset->descent(bv->painter(), font);
x = inset->x() + inset->width(bv, font);
y = inset->descent(bv, font);
}
inset_x = cursor.x() - top_x + tabular->GetBeginningOfTextInCell(actcell);
inset_y = cursor.y();
@ -1296,13 +1296,12 @@ bool InsetTabular::InsetHit(BufferView * bv, int x, int ) const
if (cursor.pos() % 2) { // behind the inset
return (((x + top_x) < cursor.x()) &&
((x + top_x) > (cursor.x() - inset->width(bv->painter(),
((x + top_x) > (cursor.x() - inset->width(bv,
LyXFont(LyXFont::ALL_SANE)))));
} else {
int x2 = cursor.x() + tabular->GetBeginningOfTextInCell(actcell);
return ((x1 > x2) &&
(x1 < (x2 + inset->width(bv->painter(),
LyXFont(LyXFont::ALL_SANE)))));
(x1 < (x2 + inset->width(bv, LyXFont(LyXFont::ALL_SANE)))));
}
}
@ -1349,7 +1348,7 @@ void InsetTabular::recomputeTextInsets(BufferView * bv, const LyXFont & font) co
cell = tabular->GetCellNumber(i,j);
inset = tabular->GetCellInset(cell);
inset->update(bv, font);
tabular->SetWidthOfCell(cell, inset->width(bv->painter(), font));
tabular->SetWidthOfCell(cell, inset->width(bv, font));
}
// cell = tabular->GetCellNumber(0, j);
// cx += tabular->GetWidthOfColumn(cell);

View File

@ -83,11 +83,11 @@ public:
///
void Write(Buffer const *, std::ostream &) const;
///
int ascent(Painter &, LyXFont const &) const;
int ascent(BufferView *, LyXFont const &) const;
///
int descent(Painter &, LyXFont const &) const;
int descent(BufferView *, LyXFont const &) const;
///
int width(Painter &, LyXFont const & f) const;
int width(BufferView *, LyXFont const & f) const;
///
void draw(BufferView *, const LyXFont &, int , float &, bool) const;
///
@ -173,7 +173,7 @@ private:
///
void HideInsetCursor(BufferView *);
///
void setPos(Painter &, int x, int y) const;
void setPos(BufferView *, int x, int y) const;
///
UpdatableInset::RESULT moveRight(BufferView *, bool lock=true);
UpdatableInset::RESULT moveLeft(BufferView *, bool lock=true);
@ -184,7 +184,7 @@ private:
bool Delete();
///
int getCellXPos(int cell) const;
void resetPos(Painter &) const;
void resetPos(BufferView *) const;
///
void RemoveTabularRow();
///

View File

@ -186,20 +186,28 @@ void InsetText::Read(Buffer const * buf, LyXLex & lex)
}
int InsetText::ascent(Painter &, LyXFont const &) const
int InsetText::ascent(BufferView * bv, LyXFont const &) const
{
long int y_temp = 0;
Row * row = TEXT(bv)->GetRowNearY(y_temp);
insetAscent = row->ascent_of_text() + TEXT_TO_INSET_OFFSET;
return insetAscent;
}
int InsetText::descent(Painter &, LyXFont const &) const
int InsetText::descent(BufferView * bv, LyXFont const &) const
{
long int y_temp = 0;
Row * row = TEXT(bv)->GetRowNearY(y_temp);
insetDescent = TEXT(bv)->height - row->ascent_of_text() +
TEXT_TO_INSET_OFFSET;
return insetDescent;
}
int InsetText::width(Painter &, LyXFont const &) const
int InsetText::width(BufferView * bv, LyXFont const &) const
{
insetWidth = TEXT(bv)->width + (2 * TEXT_TO_INSET_OFFSET);
return insetWidth;
}
@ -211,9 +219,9 @@ int InsetText::textWidth(Painter & pain) const
// printf("WW1: %d\n",w);
return w;
}
#if 0
#if 1
if (owner()) {
w = w - top_x; // + owner()->x();
w = w - top_x + owner()->x();
// printf("WW2: %d\n",w);
return w; // - top_x + owner()->x();
}
@ -229,6 +237,9 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
{
Painter & pain = bv->painter();
xpos = x;
UpdatableInset::draw(bv, f, baseline, x, cleared);
if (!cleared && ((need_update==FULL) || (top_x!=int(x)) ||
(top_baseline!=baseline))) {
int w = insetWidth;
@ -245,25 +256,25 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
cleared = true;
need_update = FULL;
}
if (!cleared && (need_update == NONE))
return;
xpos = x;
UpdatableInset::draw(bv, f, baseline, x, cleared);
if (top_x != int(x)) {
need_update = INIT;
}
top_baseline = baseline;
top_x = int(x);
top_y = baseline - ascent(pain, f);
last_width = width(pain, f);
last_height = ascent(pain, f) + descent(pain, f);
top_y = baseline - ascent(bv, f);
last_width = width(bv, f);
last_height = ascent(bv, f) + descent(bv, f);
if (the_locking_inset && (cpar(bv) == inset_par) && (cpos(bv) == inset_pos)) {
inset_x = cx(bv) - top_x + drawTextXOffset;
inset_y = cy(bv) + drawTextYOffset;
}
if (!cleared && (need_update == CURSOR)) {
x += width(pain, f);
x += width(bv, f);
need_update = NONE;
return;
}
@ -295,7 +306,8 @@ void InsetText::draw(BufferView * bv, LyXFont const & f,
LColor::background);
}
x += insetWidth - TEXT_TO_INSET_OFFSET;
need_update = NONE;
if (need_update != INIT)
need_update = NONE;
}
@ -1063,10 +1075,12 @@ bool InsetText::checkAndActivateInset(BufferView * bv, bool behind)
int x, y;
Inset * inset =
static_cast<UpdatableInset*>(cpar(bv)->GetInset(cpos(bv)));
if (!inset || inset->Editable() != Inset::HIGHLY_EDITABLE)
return false;
LyXFont font = TEXT(bv)->GetFont(bv->buffer(), cpar(bv), cpos(bv));
if (behind) {
x = inset->width(bv->painter(), font);
y = inset->descent(bv->painter(), font);
x = inset->width(bv, font);
y = inset->descent(bv, font);
} else {
x = y = 0;
}
@ -1108,7 +1122,10 @@ bool InsetText::checkAndActivateInset(BufferView * bv, int x, int y,
int InsetText::getMaxWidth(Painter & pain, UpdatableInset const * inset) const
{
return UpdatableInset::getMaxWidth(pain, inset) - (2*TEXT_TO_INSET_OFFSET);
int w = UpdatableInset::getMaxWidth(pain, inset);
if (w < 0)
return w;
return w - (2*TEXT_TO_INSET_OFFSET);
}
@ -1220,7 +1237,7 @@ LyXText * InsetText::getLyXText(BufferView * bv) const
}
void InsetText::deleteLyXText(BufferView * bv)
void InsetText::deleteLyXText(BufferView * bv) const
{
cache.erase(bv);
/// then remove all LyXText in text-insets

View File

@ -72,11 +72,11 @@ public:
///
void Write(Buffer const *, std::ostream &) const;
///
int ascent(Painter &, LyXFont const &) const;
int ascent(BufferView *, LyXFont const &) const;
///
int descent(Painter &, LyXFont const &) const;
int descent(BufferView *, LyXFont const &) const;
///
int width(Painter &, LyXFont const & f) const;
int width(BufferView *, LyXFont const & f) const;
///
int textWidth(Painter &) const;
///
@ -153,7 +153,7 @@ public:
// LyXFont GetDrawFont(BufferView *, LyXParagraph *, int pos) const;
///
LyXText * getLyXText(BufferView *) const;
void deleteLyXText(BufferView *);
void deleteLyXText(BufferView *) const;
LyXParagraph * par;
///
@ -214,9 +214,9 @@ private:
///
mutable bool locked;
///
int insetAscent;
int insetDescent;
int insetWidth;
mutable int insetAscent;
mutable int insetDescent;
mutable int insetWidth;
mutable int last_width;
mutable int last_height;
mutable int top_y;

View File

@ -119,11 +119,11 @@ public:
///
virtual ~Inset() {}
///
virtual int ascent(Painter &, LyXFont const &) const = 0;
virtual int ascent(BufferView *, LyXFont const &) const = 0;
///
virtual int descent(Painter &, LyXFont const &) const = 0;
virtual int descent(BufferView *, LyXFont const &) const = 0;
///
virtual int width(Painter &, LyXFont const &) const = 0;
virtual int width(BufferView *, LyXFont const &) const = 0;
///
virtual void draw(BufferView *, LyXFont const &,
int baseline, float & x, bool cleared) const = 0;

View File

@ -1398,8 +1398,9 @@ string LyXFunc::Dispatch(int ac,
txt->cursor.par(),
txt->cursor.pos());
tmpinset->Edit(owner->view(),
tmpinset->x() + tmpinset->width(owner->view()->painter(),font),
tmpinset->descent(owner->view()->painter(),font),
tmpinset->x() +
tmpinset->width(owner->view(),font),
tmpinset->descent(owner->view(),font),
0);
break;
}

View File

@ -383,19 +383,19 @@ void InsetFormula::Read(Buffer const *, LyXLex & lex)
}
int InsetFormula::ascent(Painter &, LyXFont const &) const
int InsetFormula::ascent(BufferView *, LyXFont const &) const
{
return par->Ascent() + ((disp_flag) ? 8 : 1);
}
int InsetFormula::descent(Painter &, LyXFont const &) const
int InsetFormula::descent(BufferView *, LyXFont const &) const
{
return par->Descent() + ((disp_flag) ? 8 : 1);
}
int InsetFormula::width(Painter &, LyXFont const & f) const
int InsetFormula::width(BufferView *, LyXFont const & f) const
{
lfont_size = f.size();
par->Metrics();
@ -428,7 +428,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & f,
} else {
par->draw(pain, int(x), baseline);
}
x += float(width(pain, font));
x += float(width(bv, font));
if (par->GetType() == LM_OT_PARN || par->GetType() == LM_OT_MPARN) {
LyXFont wfont = WhichFont(LM_TC_BF, par->size);

View File

@ -41,11 +41,11 @@ public:
///
~InsetFormula();
///
int ascent(Painter &, LyXFont const &) const;
int ascent(BufferView *, LyXFont const &) const;
///
int descent(Painter &, LyXFont const &) const;
int descent(BufferView *, LyXFont const &) const;
///
int width(Painter &, LyXFont const &) const;
int width(BufferView *, LyXFont const &) const;
///
void draw(BufferView *,LyXFont const &, int, float &, bool) const;
///

View File

@ -114,7 +114,7 @@ void InsetFormulaMacro::Read(Buffer const *, LyXLex & lex)
}
int InsetFormulaMacro::ascent(Painter & pain, LyXFont const & f) const
int InsetFormulaMacro::ascent(BufferView * pain, LyXFont const & f) const
{
if (opened) {
tmacro->update();
@ -124,7 +124,7 @@ int InsetFormulaMacro::ascent(Painter & pain, LyXFont const & f) const
}
int InsetFormulaMacro::descent(Painter & pain, LyXFont const & f) const
int InsetFormulaMacro::descent(BufferView * pain, LyXFont const & f) const
{
if (opened) {
tmacro->update();
@ -134,11 +134,11 @@ int InsetFormulaMacro::descent(Painter & pain, LyXFont const & f) const
}
int InsetFormulaMacro::width(Painter & pain, LyXFont const & f) const
int InsetFormulaMacro::width(BufferView * bv, LyXFont const & f) const
{
if (opened) {
tmacro->update();
return InsetFormula::width(pain, f);
return InsetFormula::width(bv, f);
}
string ilabel(_("Macro: "));
ilabel += name;
@ -159,9 +159,9 @@ void InsetFormulaMacro::draw(BufferView * bv, LyXFont const & f,
} else {
font.setColor(LColor::math);
int y = baseline - ascent(pain, font) + 1;
int w = width(pain, font) - 2;
int h = (ascent(pain, font) + descent(pain, font) - 2);
int y = baseline - ascent(bv, font) + 1;
int w = width(bv, font) - 2;
int h = (ascent(bv, font) + descent(bv, font) - 2);
pain.fillRectangle(int(x), y, w, h, LColor::mathbg);
@ -170,7 +170,7 @@ void InsetFormulaMacro::draw(BufferView * bv, LyXFont const & f,
string s(_("Macro: "));
s += name;
pain.text(int(x + 2), baseline, s, font);
x += width(pain, font) - 1;
x += width(bv, font) - 1;
}
}

View File

@ -37,11 +37,11 @@ public:
///
~InsetFormulaMacro();
///
int ascent(Painter &, LyXFont const &) const;
int ascent(BufferView *, LyXFont const &) const;
///
int descent(Painter &, LyXFont const &) const;
int descent(BufferView *, LyXFont const &) const;
///
int width(Painter &, LyXFont const &) const;
int width(BufferView *, LyXFont const &) const;
///
void draw(BufferView *,LyXFont const &, int, float &, bool) const;
///

View File

@ -50,7 +50,7 @@ int tex_code_break_column = 72; // needs non-zero initialization. set later.
// this is a bad idea, but how can LyXParagraph find its buffer to get
// parameters? (JMarc)
extern BufferView * current_view;
extern string bibitemWidest(Painter &);
extern string bibitemWidest(BufferView *);
// this is a minibuffer
static char minibuffer_char;
@ -3650,7 +3650,7 @@ LyXParagraph * LyXParagraph::TeXEnvironment(Buffer const * buf,
} else if (style.labeltype == LABEL_BIBLIO) {
// ale970405
os << "\\begin{" << style.latexname() << "}{"
<< bibitemWidest(current_view->painter())
<< bibitemWidest(current_view)
<< "}\n";
} else if (style.latextype == LATEX_ITEM_ENVIRONMENT) {
#ifdef FANCY_FOOTNOTE_CODE

View File

@ -382,9 +382,9 @@ void LyXScreen::Update(LyXText * text, int y_offset, int x_offset)
long y = max(text->refresh_y - long(text->first), 0L);
int height;
if (text->inset_owner)
height = text->inset_owner->ascent(owner.owner()->painter(),
text->real_current_font)
+ text->inset_owner->descent(owner.owner()->painter(),
height = text->inset_owner->ascent(owner.owner(),
text->real_current_font)
+ text->inset_owner->descent(owner.owner(),
text->real_current_font);
else
height = owner.height();

View File

@ -43,7 +43,7 @@ using std::endl;
using std::pair;
static const int LYX_PAPER_MARGIN = 20;
extern int bibitemMaxWidth(Painter &, LyXFont const &);
extern int bibitemMaxWidth(BufferView *, LyXFont const &);
int LyXText::workWidth(BufferView * bview) const
@ -181,7 +181,7 @@ int LyXText::SingleWidth(BufferView * bview, LyXParagraph * par,
Inset * tmpinset = par->GetInset(pos);
if (tmpinset) {
tmpinset->update(bview, font);
return tmpinset->width(bview->painter(), font);
return tmpinset->width(bview, font);
} else
return 0;
@ -849,8 +849,7 @@ int LyXText::LeftMargin(BufferView * bview, Row const * row) const
.defaultfont());
else if (layout.labeltype == LABEL_BIBLIO) {
// ale970405 Right width for bibitems
x += bibitemMaxWidth(bview->painter(),
textclasslist
x += bibitemMaxWidth(bview,textclasslist
.TextClass(bview->buffer()->params
.textclass)
.defaultfont());
@ -1401,9 +1400,9 @@ void LyXText::SetHeightOfRow(BufferView * bview, Row * row_ptr) const
tmpinset = row_ptr->par()->GetInset(pos);
if (tmpinset) {
tmpinset->update(bview, tmpfont);
asc = tmpinset->ascent(bview->painter(), tmpfont);
desc = tmpinset->descent(bview->painter(), tmpfont);
maxwidth += tmpinset->width(bview->painter(), tmpfont);
asc = tmpinset->ascent(bview, tmpfont);
desc = tmpinset->descent(bview, tmpfont);
maxwidth += tmpinset->width(bview, tmpfont);
maxasc = max(maxasc, asc);
maxdesc = max(maxdesc, desc);
}
@ -3798,16 +3797,16 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
} else if (clear_area) {
int w;
if (inset_owner)
w = inset_owner->width(bview->painter(), font);
w = inset_owner->width(bview, font);
else
w = ww;
pain.fillRectangle(x_offset, y_offset, w, row_ptr->height());
} else if (inset != 0) {
int h = row_ptr->baseline() - inset->ascent(pain, font);
int h = row_ptr->baseline() - inset->ascent(bview, font);
if (h > 0) {
int w;
if (inset_owner)
w = inset_owner->width(bview->painter(), font);
w = inset_owner->width(bview, font);
else
w = ww;
pain.fillRectangle(x_offset, y_offset, w, h);
@ -4326,7 +4325,7 @@ void LyXText::GetVisibleRow(BufferView * bview, int y_offset, int x_offset,
+ lyxfont::width(layout.labelsep, font);
else
tmpx = x - lyxfont::width(layout.labelsep, font)
- row_ptr->par()->bibkey->width(bview->painter(), font);
- row_ptr->par()->bibkey->width(bview, font);
row_ptr->par()->bibkey->draw(bview, font,
y_offset + row_ptr->baseline(),
tmpx, clear_area);