]> git.lyx.org Git - lyx.git/blobdiff - src/insets/inset.C
The speed patch: redraw only rows that have changed
[lyx.git] / src / insets / inset.C
index 9d56a9713bb1d89fef593532d76192ea90ec50f1..38640a11f9fa9822426b1bf5027aed17c873e3dd 100644 (file)
 #include <config.h>
 
 #include "inset.h"
-#include "updatableinset.h"
 
 #include "BufferView.h"
 #include "debug.h"
 #include "gettext.h"
 #include "lyxtext.h"
 #include "LColor.h"
-
+#include "metricsinfo.h"
+#include "coordcache.h"
 
 using std::string;
 
 
 InsetOld::InsetOld()
-       : InsetBase(),
-         xo_(0), yo_(0), scx(0), owner_(0),
-         //background_color_(LColor::inherit)
+       : //background_color_(LColor::inherit)
          background_color_(LColor::background)
 {}
 
 
 InsetOld::InsetOld(InsetOld const & in)
-       : InsetBase(),
-         xo_(0), yo_(0), scx(0), owner_(0), name_(in.name_),
+       : InsetBase(in), name_(in.name_),
          background_color_(in.background_color_)
 {}
 
 
-bool InsetOld::directWrite() const
-{
-       return false;
-}
-
-
-InsetOld::EDITABLE InsetOld::editable() const
-{
-       return NOT_EDITABLE;
-}
-
-
-bool InsetOld::autoDelete() const
-{
-       return false;
-}
-
-
-string const InsetOld::editMessage() const
-{
-       return _("Opened inset");
-}
-
-
 void InsetOld::setBackgroundColor(LColor_color color)
 {
        background_color_ = color;
@@ -77,14 +50,6 @@ LColor_color InsetOld::backgroundColor() const
 }
 
 
-bool InsetOld::forceDefaultParagraphs(InsetOld const * inset) const
-{
-       if (owner())
-               return owner()->forceDefaultParagraphs(inset);
-       return false;
-}
-
-
 int InsetOld::ascent() const
 {
        return dim_.asc;
@@ -103,52 +68,8 @@ int InsetOld::width() const
 }
 
 
-bool InsetOld::insetAllowed(InsetOld * in) const
-{
-       return insetAllowed(in->lyxCode());
-}
-
-
-int InsetOld::scroll(bool recursive) const
+void InsetOld::setPosCache(PainterInfo const &, int x, int y) const
 {
-       if (!recursive || !owner_)
-               return scx;
-       return 0;
+       //lyxerr << "InsetOld:: position cache to " << x << " " << y << std::endl;
+       theCoords.insets().add(this, x, y);
 }
-
-
-int InsetOld::getCell(int x, int y) const
-{
-       for (int i = 0, n = numParagraphs(); i < n; ++i) {
-               LyXText * text = getText(i);
-               //lyxerr << "### text: " << text << " i: " << i
-               //      << " xo: " << text->xo_ << "..." << text->xo_ + text->width
-               //      << " yo: " << text->yo_ 
-               //      << " yo: " << text->yo_ - text->ascent() << "..."
-               //              <<  text->yo_ + text->descent()
-               //      << std::endl;   
-               if (x >= text->xo_
-                               && x <= text->xo_ + text->width
-                               && y >= text->yo_ 
-                               && y <= text->yo_ + text->height)
-               {
-                       lyxerr << "### found text # " << i << std::endl;        
-                       return i;
-               }
-       }
-       return -1;
-}
-
-
-bool isEditableInset(InsetOld const * i)
-{
-       return i && i->editable();
-}
-
-
-bool isHighlyEditableInset(InsetOld const * i)
-{
-       return i && i->editable() == InsetOld::HIGHLY_EDITABLE;
-}
-
-