*
* LyX, The Document Processor
*
- * Copyright (C) 1998 The LyX Team.
+ * Copyright 1998-2001 The LyX Team.
*
* ======================================================
*/
using std::max;
InsetCollapsable::InsetCollapsable()
- : UpdatableInset()
+ : UpdatableInset(), inset(new InsetText)
{
- inset = new InsetText;
+ //inset = new InsetText;
inset->setOwner(this);
collapsed = true;
label = "Label";
}
-Inset * InsetCollapsable::Clone() const
+Inset * InsetCollapsable::Clone(Buffer const &) const
{
InsetCollapsable * result = new InsetCollapsable();
result->inset->init(inset);
{
if (lex.IsOK()) {
lex.next();
- string token = lex.GetString();
+ string const token = lex.GetString();
if (token == "collapsed") {
lex.next();
collapsed = lex.GetBool();
int InsetCollapsable::ascent_collapsed(Painter & pain, LyXFont const &) const
{
- int width = 0, ascent = 0, descent = 0;
+ int width = 0;
+ int ascent = 0;
+ int descent = 0;
pain.buttonText(0, 0, label, labelfont, false,
width, ascent, descent);
return ascent;
int InsetCollapsable::descent_collapsed(Painter & pain, LyXFont const &) const
{
- int width = 0, ascent = 0, descent = 0;
+ int width = 0;
+ int ascent = 0;
+ int descent = 0;
pain.buttonText(0, 0, label, labelfont, false,
width, ascent, descent);
return descent;
int InsetCollapsable::width_collapsed(Painter & pain, LyXFont const &) const
{
- int width, ascent, descent;
+ int width;
+ int ascent;
+ int descent;
pain.buttonText(TEXT_TO_INSET_OFFSET, 0, label, labelfont, false,
width, ascent, descent);
return width + (2*TEXT_TO_INSET_OFFSET);
h = pain.paperHeight();
if ((top_x + w) > pain.paperWidth())
w = pain.paperWidth();
+ if (baseline < 0)
+ h += (baseline - ascent(bv, f));
pain.fillRectangle(tx, ty - 1, w, h + 2);
cleared = true;
}
} else if (!collapsed) {
if (!bv->lockInset(this))
return;
- inset->Edit(bv, x-widthCollapsed, y, button);
+ inset->Edit(bv, x - widthCollapsed, y, button);
}
}
void InsetCollapsable::InsetButtonPress(BufferView * bv,int x,int y,int button)
{
if (!collapsed && (x >= button_length)) {
- inset->InsetButtonPress(bv, x-widthCollapsed, y, button);
+ inset->InsetButtonPress(bv, x - widthCollapsed, y, button);
}
}
bv->updateInset(this, false);
}
} else if (!collapsed && (x >= button_length) && (y >= button_top_y)) {
- inset->InsetButtonRelease(bv, x-widthCollapsed, y, button);
+ inset->InsetButtonRelease(bv, x - widthCollapsed, y, button);
}
}
int InsetCollapsable::getMaxWidth(Painter & pain,
UpdatableInset const * inset) const
{
- int w = UpdatableInset::getMaxWidth(pain,inset);
+ int const w = UpdatableInset::getMaxWidth(pain, inset);
if (w < 0) {
// What does a negative max width signify? (Lgb)
UpdatableInset::RESULT
-InsetCollapsable::LocalDispatch(BufferView * bv, int action,
+InsetCollapsable::LocalDispatch(BufferView * bv, kb_action action,
string const & arg)
{
UpdatableInset::RESULT result = inset->LocalDispatch(bv, action, arg);
}
-int InsetCollapsable::InsetInInsetY()
+unsigned int InsetCollapsable::InsetInInsetY()
{
return inset->InsetInInsetY();
}
}
-LyXText * InsetCollapsable::getLyXText(BufferView * bv) const
+LyXText * InsetCollapsable::getLyXText(BufferView const * bv,
+ bool const recursive) const
{
- return inset->getLyXText(bv);
+ return inset->getLyXText(bv, recursive);
}