]> git.lyx.org Git - lyx.git/blobdiff - src/insets/inset.C
Final touch 'inset display()'; fix 'is a bit silly' bug
[lyx.git] / src / insets / inset.C
index f67d5d7246b3997427ed6212ac30d6aefc3e13b3..f28c9d6b8d1645018a60af6a8b62f236d42803cd 100644 (file)
@@ -8,70 +8,61 @@
  * \author Lars Gullik Bjønnes
  * \author Matthias Ettrich
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #include <config.h>
 
 #include "inset.h"
+#include "updatableinset.h"
+
 #include "BufferView.h"
-#include "funcrequest.h"
 #include "gettext.h"
-#include "lyxfont.h"
-#include "lyxtext.h"
-#include "dimension.h"
-#include "metricsinfo.h"
-
-#include "insets/updatableinset.h"
-
-#include "frontends/Painter.h"
-#include "frontends/mouse_state.h"
+#include "LColor.h"
 
-#include "support/lstrings.h"
 
+using std::string;
 
-#include "debug.h"
 
 // Initialization of the counter for the inset id's,
-unsigned int Inset::inset_id = 0;
+unsigned int InsetOld::inset_id = 0;
 
-Inset::Inset()
+InsetOld::InsetOld()
        : InsetBase(),
        top_x(0), top_baseline(0), scx(0),
-       id_(inset_id++), owner_(0), par_owner_(0),
+       id_(inset_id++), owner_(0),
        background_color_(LColor::inherit)
 {}
 
 
-Inset::Inset(Inset const & in)
+InsetOld::InsetOld(InsetOld const & in)
        : InsetBase(),
-       top_x(0), top_baseline(0), scx(0), id_(in.id_), owner_(0),
+       top_x(0), top_baseline(0), scx(0),
+       id_(in.id_), owner_(0),
        name_(in.name_), background_color_(in.background_color_)
-{
-       lyxerr << "inset id: " << id_ << std::endl;
-}
+{}
 
 
-bool Inset::directWrite() const
+bool InsetOld::directWrite() const
 {
        return false;
 }
 
 
-Inset::EDITABLE Inset::editable() const
+InsetOld::EDITABLE InsetOld::editable() const
 {
        return NOT_EDITABLE;
 }
 
 
-bool Inset::autoDelete() const
+bool InsetOld::autoDelete() const
 {
        return false;
 }
 
 
 #if 0
-LyXFont const Inset::convertFont(LyXFont const & font) const
+LyXFont const InsetOld::convertFont(LyXFont const & font) const
 {
 #if 1
        return font;
@@ -82,13 +73,13 @@ LyXFont const Inset::convertFont(LyXFont const & font) const
 #endif
 
 
-string const Inset::editMessage() const
+string const InsetOld::editMessage() const
 {
        return _("Opened inset");
 }
 
 
-LyXText * Inset::getLyXText(BufferView const * bv, bool /*recursive*/) const
+LyXText * InsetOld::getLyXText(BufferView const * bv, bool /*recursive*/) const
 {
        if (owner())
                return owner()->getLyXText(bv, false);
@@ -97,13 +88,13 @@ LyXText * Inset::getLyXText(BufferView const * bv, bool /*recursive*/) const
 }
 
 
-void Inset::setBackgroundColor(LColor::color color)
+void InsetOld::setBackgroundColor(LColor_color color)
 {
        background_color_ = color;
 }
 
 
-LColor::color Inset::backgroundColor() const
+LColor_color InsetOld::backgroundColor() const
 {
        if (background_color_ == LColor::inherit) {
                if (owner())
@@ -111,32 +102,32 @@ LColor::color Inset::backgroundColor() const
                else
                        return LColor::background;
        } else
-               return background_color_;
+               return LColor::color(background_color_);
 }
 
 
-int Inset::id() const
+int InsetOld::id() const
 {
        return id_;
 }
 
-void Inset::id(int id_arg)
+void InsetOld::id(int id_arg)
 {
        id_ = id_arg;
 }
 
-void Inset::setFont(BufferView *, LyXFont const &, bool, bool)
+void InsetOld::setFont(BufferView *, LyXFont const &, bool, bool)
 {}
 
 
-bool Inset::forceDefaultParagraphs(Inset const * inset) const
+bool InsetOld::forceDefaultParagraphs(InsetOld const * inset) const
 {
        if (owner())
                return owner()->forceDefaultParagraphs(inset);
        return false;
 }
 
-int Inset::latexTextWidth(BufferView * bv) const
+int InsetOld::latexTextWidth(BufferView * bv) const
 {
        if (owner())
                return (owner()->latexTextWidth(bv));
@@ -144,19 +135,43 @@ int Inset::latexTextWidth(BufferView * bv) const
 }
 
 
-int Inset::ascent() const
+int InsetOld::ascent() const
 {
        return dim_.asc;
 }
 
 
-int Inset::descent() const
+int InsetOld::descent() const
 {
        return dim_.des;
 }
 
 
-int Inset::width() const
+int InsetOld::width() const
 {
        return dim_.wid;
 }
+
+
+bool InsetOld::insetAllowed(InsetOld * in) const
+{
+       return insetAllowed(in->lyxCode());
+}
+
+
+bool InsetOld::checkInsertChar(LyXFont &)
+{
+       return false;
+}
+
+
+bool isEditableInset(InsetOld const * i)
+{
+       return i && i->editable();
+}
+
+
+bool isHighlyEditableInset(InsetOld const * i)
+{
+       return i && i->editable() == InsetOld::HIGHLY_EDITABLE;
+}