/* This file is part of
- * ======================================================
- *
+ * ======================================================
+ *
* LyX, The Document Processor
- *
+ *
* Copyright 1995 Matthias Ettrich
* Copyright 1995-2001 The LyX Team.
*
#endif
-string const Inset::editMessage() const
+string const Inset::editMessage() const
{
return _("Opened inset");
}
id_ = id_arg;
}
-void Inset::setFont(BufferView *, LyXFont const &, bool, bool )
+void Inset::setFont(BufferView *, LyXFont const &, bool, bool)
{}
return false;
}
+int Inset::latexTextWidth(BufferView * bv) const
+{
+ if (owner())
+ return (owner()->latexTextWidth(bv));
+ return bv->workWidth();
+}
// some stuff for inset locking
void UpdatableInset::scroll(BufferView * bv, float s) const
{
LyXFont font;
-
+
if (!s) {
scx = 0;
return;
int const workW = bv->workWidth();
int const tmp_top_x = top_x - scx;
-
- if (tmp_top_x > 0 &&
+
+ if (tmp_top_x > 0 &&
(tmp_top_x + width(bv, font)) < workW)
return;
if (s > 0 && top_x > 0)
// int mx_scx=abs((width(bv,font) - bv->workWidth())/2);
//int const save_scx = scx;
-
+
scx = int(s * workW / 2);
// if (!display())
// scx += 20;
if (!scx && (top_x + width(bv, font)) < (bv->workWidth() - 20))
return;
if ((top_x - scx + offset + width(bv, font)) < (bv->workWidth() - 20)) {
- scx = bv->workWidth() - width(bv, font) - top_x + scx - 20;
+ scx = bv->workWidth() - width(bv, font) - top_x + scx - 20;
} else {
scx += offset;
}
/// An updatable inset could handle lyx editing commands
UpdatableInset::RESULT
-UpdatableInset::localDispatch(BufferView * bv,
- kb_action action, string const & arg)
+UpdatableInset::localDispatch(BufferView * bv,
+ kb_action action, string const & arg)
{
if (!arg.empty() && (action==LFUN_SCROLL_INSET)) {
if (arg.find('.') != arg.npos) {
scroll(bv, xx);
}
bv->updateInset(this, false);
-
+
return DISPATCHED;
}
- return UNDISPATCHED;
+ return UNDISPATCHED;
}
int UpdatableInset::getMaxWidth(BufferView * bv, UpdatableInset const *) const
{
int w;
- if (owner()){
+ if (owner()) {
w = static_cast<UpdatableInset*>
(owner())->getMaxWidth(bv, this);
} else {
bool UpdatableInset::searchForward(BufferView * bv, string const &,
- bool, bool)
+ bool, bool)
{
// we have to unlock ourself in this function by default!
bv->unlockInset(const_cast<UpdatableInset *>(this));
bool UpdatableInset::searchBackward(BufferView * bv, string const &,
- bool, bool)
+ bool, bool)
{
// we have to unlock ourself in this function by default!
bv->unlockInset(const_cast<UpdatableInset *>(this));