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"
24 #include "frontends/Painter.h"
25 #include "frontends/mouse_state.h"
27 #include "support/lstrings.h"
32 // Initialization of the counter for the inset id's,
33 unsigned int Inset::inset_id = 0;
37 top_x(0), top_baseline(0), scx(0),
38 id_(inset_id++), owner_(0), par_owner_(0),
39 background_color_(LColor::inherit)
43 Inset::Inset(Inset const & in, bool same_id)
45 top_x(0), top_baseline(0), scx(0), owner_(0),
46 name_(in.name_), background_color_(in.background_color_)
55 bool Inset::directWrite() const
61 Inset::EDITABLE Inset::editable() const
67 void Inset::validate(LaTeXFeatures &) const
71 bool Inset::autoDelete() const
78 LyXFont const Inset::convertFont(LyXFont const & font) const
89 string const Inset::editMessage() const
91 return _("Opened inset");
95 LyXText * Inset::getLyXText(BufferView const * bv, bool const) const
98 return owner()->getLyXText(bv, false);
104 void Inset::setBackgroundColor(LColor::color color)
106 background_color_ = color;
110 LColor::color Inset::backgroundColor() const
112 if (background_color_ == LColor::inherit) {
114 return owner()->backgroundColor();
116 return LColor::background;
118 return background_color_;
122 int Inset::id() const
127 void Inset::id(int id_arg)
132 void Inset::setFont(BufferView *, LyXFont const &, bool, bool)
136 bool Inset::forceDefaultParagraphs(Inset const * inset) const
139 return owner()->forceDefaultParagraphs(inset);
143 int Inset::latexTextWidth(BufferView * bv) const
146 return (owner()->latexTextWidth(bv));
147 return bv->workWidth();
151 int Inset::ascent(BufferView * bv, LyXFont const & font) const
154 dimension(bv, font, dim);
159 int Inset::descent(BufferView * bv, LyXFont const & font) const
162 dimension(bv, font, dim);
163 return dim.descent();
167 int Inset::width(BufferView * bv, LyXFont const & font) const
170 dimension(bv, font, dim);