]> git.lyx.org Git - lyx.git/blobdiff - src/insets/inset.C
* src/LyXAction.C: mark goto-clear-bookmark as working without buffer
[lyx.git] / src / insets / inset.C
index ff8d77a51fc33b065ae64eaa6e1a98eb0344cc9a..5f0b633794979a5e7b0c6f9fb2c615067bc68579 100644 (file)
  * \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 "BufferView.h"
-#include "funcrequest.h"
+#include "debug.h"
 #include "gettext.h"
-#include "lyxfont.h"
 #include "lyxtext.h"
+#include "LColor.h"
+#include "metricsinfo.h"
+#include "coordcache.h"
 
-#include "frontends/Painter.h"
-#include "frontends/mouse_state.h"
-
-#include "support/lstrings.h"
 
-using std::endl;
+namespace lyx {
 
-// Insets default methods
+using std::string;
 
-// Initialization of the counter for the inset id's,
-unsigned int Inset::inset_id = 0;
 
-Inset::Inset()
-       : InsetBase(),
-       top_x(0), top_baseline(0), scx(0),
-       id_(inset_id++), owner_(0), par_owner_(0),
-       background_color_(LColor::inherit)
+InsetOld::InsetOld()
+       : //background_color_(LColor::inherit)
+         background_color_(LColor::background)
 {}
 
 
-Inset::Inset(Inset const & in, bool same_id)
-       : InsetBase(),
-       top_x(0), top_baseline(0), scx(0), owner_(0),
-       name_(in.name_), background_color_(in.background_color_)
-{
-       if (same_id)
-               id_ = in.id();
-       else
-               id_ = inset_id++;
-}
-
-
-bool Inset::directWrite() const
-{
-       return false;
-}
-
-
-Inset::EDITABLE Inset::editable() const
-{
-       return NOT_EDITABLE;
-}
-
-
-void Inset::edit(BufferView *, int, int, mouse_button::state)
+InsetOld::InsetOld(InsetOld const & in)
+       : InsetBase(in), name_(in.name_),
+         background_color_(in.background_color_)
 {}
 
 
-void Inset::validate(LaTeXFeatures &) const
-{}
-
-
-bool Inset::autoDelete() const
+void InsetOld::setBackgroundColor(LColor_color color)
 {
-       return false;
-}
-
-
-void Inset::edit(BufferView *, bool)
-{}
-
-
-#if 0
-LyXFont const Inset::convertFont(LyXFont const & font) const
-{
-#if 1
-       return font;
-#else
-       return LyXFont(font);
-#endif
-}
-#endif
-
-
-string const Inset::editMessage() const
-{
-       return _("Opened inset");
+       background_color_ = color;
 }
 
 
-LyXText * Inset::getLyXText(BufferView const * bv, bool const) const
+LColor_color InsetOld::backgroundColor() const
 {
-       if (owner())
-               return owner()->getLyXText(bv, false);
-       else
-               return bv->text;
+       return LColor::color(background_color_);
 }
 
 
-void Inset::setBackgroundColor(LColor::color color)
+int InsetOld::ascent() const
 {
-       background_color_ = color;
+       return dim_.asc;
 }
 
 
-LColor::color Inset::backgroundColor() const
+int InsetOld::descent() const
 {
-       if (background_color_ == LColor::inherit) {
-               if (owner())
-                       return owner()->backgroundColor();
-               else
-                       return LColor::background;
-       } else
-               return background_color_;
+       return dim_.des;
 }
 
 
-int Inset::id() const
+int InsetOld::width() const
 {
-       return id_;
+       return dim_.wid;
 }
 
-void Inset::id(int id_arg)
-{
-       id_ = id_arg;
-}
 
-void Inset::setFont(BufferView *, LyXFont const &, bool, bool)
-{}
-
-
-bool Inset::forceDefaultParagraphs(Inset const * in) const
+void InsetOld::setPosCache(PainterInfo const & pi, int x, int y) const
 {
-       if (owner())
-               return owner()->forceDefaultParagraphs(in);
-       return false;
+       //lyxerr << "InsetOld:: position cache to " << x << " " << y << std::endl;
+       pi.base.bv->coordCache().insets().add(this, x, y);
 }
 
-int Inset::latexTextWidth(BufferView * bv) const
-{
-       if (owner())
-               return (owner()->latexTextWidth(bv));
-       return bv->workWidth();
-}
 
+} // namespace lyx