cur.selection() = false;
break;
- case LFUN_SCROLL_INSET:
- if (!cmd.argument.empty()) {
- int const ww = cur.bv().workWidth();
- if (cmd.argument.find('.') != cmd.argument.npos)
- setScroll(ww, static_cast<float>(convert<double>(cmd.argument)));
- else
- setScroll(ww, convert<int>(cmd.argument));
- }
- break;
-
case LFUN_RIGHTSEL:
case LFUN_RIGHT:
cell(cur.idx())->dispatch(cur, cmd);
// if (actcol < tabular.columns() - 1 && scroll(false) &&
// tabular.getWidthOfTabular() < maxwidth - 20)
// {
-// setScroll(maxwidth, 0.0F);
+// scx = 0;
// } else if (cursorx_ - offset > 20 &&
// cursorx_ - offset + col_width > maxwidth - 20) {
// setScroll(maxwidth, - col_width - 20);
// }
if (&cur.inset() != this) {
- setScroll(maxwidth, 0.0f);
+ scx = 0;
} else {
int const X1 = 0;
int const X2 = maxwidth;
}
-void UpdatableInset::setScroll(int maxwidth, double s) const
-{
- lyxerr << "UpdatableInset::setScroll: (int) " << maxwidth << std::endl;
- if (!s) {
- scx = 0;
- return;
- }
-
- int xo_ = theCoords.getInsets().x(this);
- int const tmp_xo_ = xo_ - scx;
-
- if (tmp_xo_ > 0 && tmp_xo_ + width() < maxwidth)
- return;
- if (s > 0.0 && xo_ > 0)
- return;
-
- scx = int(s * maxwidth / 2);
-
-#ifdef WITH_WARNINGS
-#warning metrics?
-#endif
- if (tmp_xo_ + scx + width() < maxwidth / 2)
- scx = maxwidth / 2 - tmp_xo_ - width();
-}
-
-
void UpdatableInset::setScroll(int maxwidth, int offset) const
{
- lyxerr << "UpdatableInset::setScroll: (double) " << maxwidth << std::endl;
+ lyxerr << "UpdatableInset::setScroll: (int) " << maxwidth << ' ' <<
+offset<< std::endl;
+
int const xo_ = theCoords.getInsets().x(this);
if (offset > 0) {
if (!scx && xo_ >= 20)
}
-void UpdatableInset::doDispatch(LCursor & cur, FuncRequest & cmd)
-{
- switch (cmd.action) {
- case LFUN_SCROLL_INSET:
- if (cmd.argument.empty()) {
- const int maxwidth = cur.bv().workWidth();
- if (cmd.argument.find('.') != cmd.argument.npos)
- setScroll(maxwidth, static_cast<float>(convert<double>(cmd.argument)));
- else
- setScroll(maxwidth, convert<int>(cmd.argument));
- } else
- cur.noUpdate();
- break;
-
- default:
- InsetBase::dispatch(cur, cmd);
- }
-}
-
-
void UpdatableInset::getCursorDim(int &, int &) const
{
BOOST_ASSERT(false);
virtual bool showInsetDialog(BufferView *) const { return false; }
protected:
- /// An updatable inset could handle lyx editing commands
- virtual void doDispatch(LCursor & cur, FuncRequest & cmd);
- /// scrolls to absolute position in maxwidth * sx units
- void setScroll(int maxwidth, double sx) const;
/// scrolls offset pixels
void setScroll(int maxwidth, int offset) const;
/// returns the actual scroll value