* inset.h: remove Inset::id_
+ * inset.h: top_x -> xo_, top_baseline -> yo_ to unify with mathed/*.[Ch]
+ * *.[Ch]: adjust
+
2003-11-10 André Pönitz <poenitz@gmx.net>
* inset.[Ch]:
InsetOld::InsetOld()
: InsetBase(),
- top_x(0), top_baseline(0), scx(0), owner_(0),
+ xo_(0), yo_(0), scx(0), owner_(0),
background_color_(LColor::inherit)
{}
InsetOld::InsetOld(InsetOld const & in)
: InsetBase(),
- top_x(0), top_baseline(0), scx(0), owner_(0),
+ xo_(0), yo_(0), scx(0), owner_(0),
name_(in.name_), background_color_(in.background_color_)
{}
///
LColor_color backgroundColor() const;
///
- int x() const { return top_x; }
+ int x() const { return xo_; }
///
- int y() const { return top_baseline; }
+ int y() const { return yo_; }
///
virtual void deleteLyXText(BufferView *, bool = true) const {}
/// returns the actuall scroll-value
virtual void addPreview(lyx::graphics::PreviewLoader &) const {}
protected:
///
- mutable int top_x;
+ mutable int xo_;
///
- mutable int top_baseline;
+ mutable int yo_;
///
mutable int scx;
///
button_dim.y1 = -aa;
button_dim.y2 = -aa + dim_collapsed.height();
- top_x = x;
- top_baseline = y;
+ xo_ = x;
+ yo_ = y;
if (!isOpen()) {
draw_collapsed(pi, x, y);
int InsetCollapsable::insetInInsetY() const
{
- return inset.y() - top_baseline + inset.insetInInsetY();
+ return inset.y() - yo_ + inset.insetInInsetY();
}
void InsetCommand::draw(PainterInfo & pi, int x, int y) const
{
+ xo_ = x;
+ yo_ = y;
button_.draw(pi, x, y);
}
if (!owner())
x += scroll();
- top_x = x;
- top_baseline = y;
+ xo_ = x;
+ yo_ = y;
x += ADD_TO_TABULAR_WIDTH;
int cell = 0;
setPos(bv, x, y);
clearSelection();
finishUndo();
- int xx = cursorx_ - top_x + tabular.getBeginningOfTextInCell(actcell);
+ int xx = cursorx_ - xo_ + tabular.getBeginningOfTextInCell(actcell);
bv->cursor().push(this);
if (x > xx)
activateCellInset(bv, x - xx, y - cursory_);
clearSelection();
int column = actcol;
if (bv->top_y() + bv->painter().paperHeight()
- < top_baseline + tabular.getHeightOfTabular())
+ < yo_ + tabular.getHeightOfTabular())
{
bv->scrollDocView(bv->top_y() + bv->painter().paperHeight());
actcell = tabular.getCellBelow(first_visible_cell) + column;
if (hs)
clearSelection();
int column = actcol;
- if (top_baseline < 0) {
+ if (yo_ < 0) {
bv->scrollDocView(bv->top_y() - bv->painter().paperHeight());
- if (top_baseline > 0)
+ if (yo_ > 0)
actcell = column;
else
actcell = tabular.getCellBelow(first_visible_cell) + column;
void InsetTabular::getCursorPos(BufferView *, int & x, int & y) const
{
- x = TEXT_TO_INSET_OFFSET + cursorx_ - top_x;
+ x = TEXT_TO_INSET_OFFSET + cursorx_ - xo_;
y = TEXT_TO_INSET_OFFSET + cursory_;
}
lx += tabular.getWidthOfColumn(actcell + 1)
+ tabular.getAdditionalWidth(actcell);
- cursorx_ = lx - tabular.getWidthOfColumn(actcell) + top_x + 2;
+ cursorx_ = lx - tabular.getWidthOfColumn(actcell) + xo_ + 2;
resetPos(bv);
}
for (; c < cell; ++c)
lx += tabular.getWidthOfColumn(c);
- return lx - tabular.getWidthOfColumn(cell) + top_x;
+ return lx - tabular.getWidthOfColumn(cell) + xo_;
}
} else if (cursorx_ - offset < 20) {
scroll(bv, 20 - cursorx_ + offset);
updateLocal(bv);
- } else if (scroll() && top_x > 20 &&
- top_x + tabular.getWidthOfTabular() > bv->workWidth() - 20) {
+ } else if (scroll() && xo_ > 20 &&
+ xo_ + tabular.getWidthOfTabular() > bv->workWidth() - 20) {
scroll(bv, old_x - cursorx_);
updateLocal(bv);
}
{
// update our idea of where we are. Clearly, we should
// not have to know this information.
- top_x = x;
- top_baseline = y;
+ xo_ = x;
+ yo_ = y;
int const start_x = x;
{
int const ttoD2 = TEXT_TO_INSET_OFFSET / 2;
int const frame_x = x + ttoD2;
- int const frame_y = top_baseline - dim_.asc + ttoD2;
+ int const frame_y = yo_ - dim_.asc + ttoD2;
int const frame_w = dim_.wid - TEXT_TO_INSET_OFFSET;
int const frame_h = dim_.asc + dim_.des - TEXT_TO_INSET_OFFSET;
pain.rectangle(frame_x, frame_y, frame_w, frame_h, frameColor());
void InsetText::getCursorPos(BufferView *, int & x, int & y) const
{
- x = cx() - top_x;
+ x = cx() - xo_;
y = cy();
}
int InsetText::cx() const
{
- return text_.cursor.x() + top_x + TEXT_TO_INSET_OFFSET;
+ return text_.cursor.x() + xo_ + TEXT_TO_INSET_OFFSET;
}
}
if (ty + h > pain.paperHeight())
h = pain.paperHeight();
- if (top_x + w > pain.paperWidth())
+ if (xo_ + w > pain.paperWidth())
w = pain.paperWidth();
pain.fillRectangle(start_x + 1, ty + 1, w - 3, h - 1, backgroundColor());
}
{
switch (cmd.action) {
case LFUN_MOUSE_RELEASE:
- if (button().box().contains(cmd.x, cmd.y))
- InsetCommandMailer("toc", *this).showDialog(cmd.view());
- return DispatchResult(true, true);
-
case LFUN_INSET_DIALOG_SHOW:
InsetCommandMailer("toc", *this).showDialog(cmd.view());
return DispatchResult(true, true);
}
int const workW = bv->workWidth();
- int const tmp_top_x = top_x - scx;
+ int const tmp_xo_ = xo_ - scx;
- if (tmp_top_x > 0 && tmp_top_x + width() < workW)
+ if (tmp_xo_ > 0 && tmp_xo_ + width() < workW)
return;
- if (s > 0 && top_x > 0)
+ if (s > 0 && xo_ > 0)
return;
scx = int(s * workW / 2);
#warning metrics?
- if (tmp_top_x + scx + width() < workW / 2)
- scx = workW / 2 - tmp_top_x - width();
+ if (tmp_xo_ + scx + width() < workW / 2)
+ scx = workW / 2 - tmp_xo_ - width();
}
void UpdatableInset::scroll(BufferView * bv, int offset) const
{
if (offset > 0) {
- if (!scx && top_x >= 20)
+ if (!scx && xo_ >= 20)
return;
- if (top_x + offset > 20)
+ if (xo_ + offset > 20)
scx = 0;
- // scx = - top_x;
+ // scx = - xo_;
else
scx += offset;
} else {
#warning metrics?
- if (!scx && top_x + width() < bv->workWidth() - 20)
+ if (!scx && xo_ + width() < bv->workWidth() - 20)
return;
- if (top_x - scx + offset + width() < bv->workWidth() - 20) {
- scx += bv->workWidth() - width() - top_x - 20;
+ if (xo_ - scx + offset + width() < bv->workWidth() - 20) {
+ scx += bv->workWidth() - width() - xo_ - 20;
} else {
scx += offset;
}
void InsetFormula::draw(PainterInfo & pi, int x, int y) const
{
+ xo_ = x;
+ yo_ = y;
+
// The previews are drawn only when we're not editing the inset.
bool const use_preview = !editing_inset(this)
&& RenderPreview::activated()
par_->draw(p, x, y);
}
-
- xo_ = x;
- yo_ = y;
-
- top_x = x;
- top_baseline = y;
-
}
InsetFormulaBase::InsetFormulaBase()
- : xo_(0), yo_(0)
{
// This is needed as long the math parser is not re-entrant
initMath();
void InsetFormulaBase::getCursorPos(BufferView *, int & x, int & y) const
{
- // calling metrics here destroys the cached xo,yo positions e.g. in
- // MathParboxinset. And it would be too expensive anyway...
- //metrics(bv);
if (!mathcursor) {
lyxerr << "getCursorPos - should not happen";
- x = y = 0;
+ x = 0;
+ y = 0;
return;
}
mathcursor->getPos(x, y);
void handleFont(BufferView * bv, std::string const & arg, std::string const & font);
///
void handleFont2(BufferView * bv, std::string const & arg);
-
- ///
- mutable int xo_;
- ///
- mutable int yo_;
};
// We don't really mess want around with mathed stuff outside mathed.