]> git.lyx.org Git - lyx.git/blobdiff - src/insets/inset.C
updates to minipage inset
[lyx.git] / src / insets / inset.C
index e948979a6b9360e6004db2c7637c2b4ef14a1733..95e69d268254f45d95607cdc2a425f42e40d5bac 100644 (file)
 #pragma implementation "lyxinset.h"
 #endif
 
-#define SCROLL_INSET
-
 #include "lyxinset.h"
 #include "debug.h"
 #include "BufferView.h"
 #include "support/lstrings.h"
 #include "Painter.h"
-#ifdef SCROLL_INSET
 #include "commandtags.h"
 #include "support/lstrings.h"
-#endif
 
 using std::endl;
 
@@ -64,22 +60,22 @@ void Inset::Edit(BufferView *, int, int, unsigned int)
 }
 
 
-LyXFont Inset::ConvertFont(LyXFont const & font) const
+LyXFont const Inset::ConvertFont(LyXFont const & font) const
 {
     return LyXFont(font);
 }
 
 
-char const * Inset::EditMessage() const 
+string const Inset::EditMessage() const 
 {
     return _("Opened inset");
 }
 
 
-LyXText * Inset::getLyXText(BufferView * bv) const
+LyXText * Inset::getLyXText(BufferView const * bv, bool const) const
 {
     if (owner())
-           return owner()->getLyXText(bv);
+           return owner()->getLyXText(bv, false);
     else
            return bv->text;
 }
@@ -132,7 +128,7 @@ void UpdatableInset::ToggleInsetCursor(BufferView *)
 }
 
 
-void UpdatableInset::ShowInsetCursor(BufferView *)
+void UpdatableInset::ShowInsetCursor(BufferView *, bool)
 {
 }
 
@@ -162,11 +158,14 @@ void UpdatableInset::SetFont(BufferView *, LyXFont const &, bool )
 }
 
 
-#ifdef SCROLL_INSET
 void UpdatableInset::scroll(BufferView * bv, float s) const
 {
     LyXFont font;
 
+    if (!s) {
+       scx = 0;
+       return;
+    }
     if (((top_x - scx) > 0) && 
        (top_x - scx + width(bv, font)) < bv->workWidth())
        return;
@@ -189,10 +188,11 @@ void UpdatableInset::scroll(BufferView * bv, float s) const
 void UpdatableInset::scroll(BufferView * bv, int offset) const
 {
     if (offset > 0) {
-       if (!scx && top_x > 0)
+       if (!scx && top_x >= 20)
            return;
        if ((top_x + offset) > 20)
-           scx += offset - (top_x - scx + offset - 20);
+           scx = 0;
+//         scx += offset - (top_x - scx + offset - 20);
        else
            scx += offset;
     } else {
@@ -208,21 +208,11 @@ void UpdatableInset::scroll(BufferView * bv, int offset) const
 //    bv->updateInset(const_cast<UpdatableInset *>(this), false);
 }
 
-
-#endif
-
 ///  An updatable inset could handle lyx editing commands
-#ifdef SCROLL_INSET
 UpdatableInset::RESULT
 UpdatableInset::LocalDispatch(BufferView * bv, 
-                             int action, string const & arg) 
-#else
-UpdatableInset::RESULT
-UpdatableInset::LocalDispatch(BufferView *, int, string const &)
-#endif
+                             kb_action action, string const & arg) 
 {
-#ifdef SCROLL_INSET
-
     if (!arg.empty() && (action==LFUN_SCROLL_INSET)) {
        if (arg.find('.') != arg.npos) {
            float xx = static_cast<float>(strToDbl(arg));
@@ -235,7 +225,6 @@ UpdatableInset::LocalDispatch(BufferView *, int, string const &)
        
        return DISPATCHED;
     }
-#endif
     return UNDISPATCHED; 
 }