3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Alejandro Aguilar Sierra
8 * \author Lars Gullik Bjønnes
9 * \author Matthias Ettrich
11 * Full author contact details are available in file CREDITS
17 #include "BufferView.h"
18 #include "funcrequest.h"
22 #include "dimension.h"
23 #include "metricsinfo.h"
25 #include "insets/updatableinset.h"
27 #include "frontends/Painter.h"
28 #include "frontends/mouse_state.h"
30 #include "support/lstrings.h"
33 // Initialization of the counter for the inset id's,
34 unsigned int Inset::inset_id = 0;
38 top_x(0), top_baseline(0), scx(0),
39 id_(inset_id++), owner_(0), par_owner_(0),
40 background_color_(LColor::inherit)
44 Inset::Inset(Inset const & in)
46 top_x(0), top_baseline(0), scx(0), owner_(0),
47 name_(in.name_), background_color_(in.background_color_)
53 bool Inset::directWrite() const
59 Inset::EDITABLE Inset::editable() const
65 bool Inset::autoDelete() const
72 LyXFont const Inset::convertFont(LyXFont const & font) const
83 string const Inset::editMessage() const
85 return _("Opened inset");
89 LyXText * Inset::getLyXText(BufferView const * bv, bool /*recursive*/) const
92 return owner()->getLyXText(bv, false);
98 void Inset::setBackgroundColor(LColor::color color)
100 background_color_ = color;
104 LColor::color Inset::backgroundColor() const
106 if (background_color_ == LColor::inherit) {
108 return owner()->backgroundColor();
110 return LColor::background;
112 return background_color_;
116 int Inset::id() const
121 void Inset::id(int id_arg)
126 void Inset::setFont(BufferView *, LyXFont const &, bool, bool)
130 bool Inset::forceDefaultParagraphs(Inset const * inset) const
133 return owner()->forceDefaultParagraphs(inset);
137 int Inset::latexTextWidth(BufferView * bv) const
140 return (owner()->latexTextWidth(bv));
141 return bv->workWidth();
145 int Inset::ascent(BufferView * bv, LyXFont const & font) const
148 MetricsInfo mi(bv, font);
154 int Inset::descent(BufferView * bv, LyXFont const & font) const
157 MetricsInfo mi(bv, font);
159 return dim.descent();
163 int Inset::width(BufferView * bv, LyXFont const & font) const
166 MetricsInfo mi(bv, font);