X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2Finset.C;h=5f0b633794979a5e7b0c6f9fb2c615067bc68579;hb=e28331ed63062dea10d0a21b9ec12034b4b17b9a;hp=07fe683d1e731d0ec785d71378e9bed3191a12ef;hpb=672ab4213766b1dc2599edf89436083e1144fb59;p=lyx.git diff --git a/src/insets/inset.C b/src/insets/inset.C index 07fe683d1e..5f0b633794 100644 --- a/src/insets/inset.C +++ b/src/insets/inset.C @@ -8,138 +8,48 @@ * \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 #include "inset.h" + #include "BufferView.h" -#include "funcrequest.h" +#include "debug.h" #include "gettext.h" -#include "lyxfont.h" #include "lyxtext.h" -#include "dimension.h" +#include "LColor.h" #include "metricsinfo.h" +#include "coordcache.h" -#include "insets/updatableinset.h" -#include "frontends/Painter.h" -#include "frontends/mouse_state.h" +namespace lyx { -#include "support/lstrings.h" +using std::string; -#include "debug.h" - -// Initialization of the counter for the inset id's, -unsigned int InsetOld::inset_id = 0; - InsetOld::InsetOld() - : InsetBase(), - top_x(0), top_baseline(0), scx(0), - id_(inset_id++), owner_(0), par_owner_(0), - background_color_(LColor::inherit) + : //background_color_(LColor::inherit) + background_color_(LColor::background) {} InsetOld::InsetOld(InsetOld const & in) - : InsetBase(), - top_x(0), top_baseline(0), scx(0), id_(in.id_), owner_(0), - 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; -} - - -#if 0 -LyXFont const InsetOld::convertFont(LyXFont const & font) const -{ -#if 1 - return font; -#else - return LyXFont(font); -#endif -} -#endif - - -string const InsetOld::editMessage() const -{ - return _("Opened inset"); -} - - -LyXText * InsetOld::getLyXText(BufferView const * bv, bool /*recursive*/) const -{ - if (owner()) - return owner()->getLyXText(bv, false); - else - return bv->text; -} + : InsetBase(in), name_(in.name_), + background_color_(in.background_color_) +{} -void InsetOld::setBackgroundColor(LColor::color color) +void InsetOld::setBackgroundColor(LColor_color color) { background_color_ = color; } -LColor::color InsetOld::backgroundColor() const -{ - if (background_color_ == LColor::inherit) { - if (owner()) - return owner()->backgroundColor(); - else - return LColor::background; - } else - return background_color_; -} - - -int InsetOld::id() const +LColor_color InsetOld::backgroundColor() const { - return id_; -} - -void InsetOld::id(int id_arg) -{ - id_ = id_arg; -} - -void InsetOld::setFont(BufferView *, LyXFont const &, bool, bool) -{} - - -bool InsetOld::forceDefaultParagraphs(InsetOld const * inset) const -{ - if (owner()) - return owner()->forceDefaultParagraphs(inset); - return false; -} - -int InsetOld::latexTextWidth(BufferView * bv) const -{ - if (owner()) - return (owner()->latexTextWidth(bv)); - return bv->workWidth(); + return LColor::color(background_color_); } @@ -159,3 +69,13 @@ int InsetOld::width() const { return dim_.wid; } + + +void InsetOld::setPosCache(PainterInfo const & pi, int x, int y) const +{ + //lyxerr << "InsetOld:: position cache to " << x << " " << y << std::endl; + pi.base.bv->coordCache().insets().add(this, x, y); +} + + +} // namespace lyx