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"
30 // Initialization of the counter for the inset id's,
31 unsigned int Inset::inset_id = 0;
35 top_x(0), top_baseline(0), scx(0),
36 id_(inset_id++), owner_(0), par_owner_(0),
37 background_color_(LColor::inherit)
41 Inset::Inset(Inset const & in)
43 top_x(0), top_baseline(0), scx(0), owner_(0),
44 name_(in.name_), background_color_(in.background_color_)
50 bool Inset::directWrite() const
56 Inset::EDITABLE Inset::editable() const
62 void Inset::validate(LaTeXFeatures &) const
66 bool Inset::autoDelete() const
73 LyXFont const Inset::convertFont(LyXFont const & font) const
84 string const Inset::editMessage() const
86 return _("Opened inset");
90 LyXText * Inset::getLyXText(BufferView const * bv, bool const) const
93 return owner()->getLyXText(bv, false);
99 void Inset::setBackgroundColor(LColor::color color)
101 background_color_ = color;
105 LColor::color Inset::backgroundColor() const
107 if (background_color_ == LColor::inherit) {
109 return owner()->backgroundColor();
111 return LColor::background;
113 return background_color_;
117 int Inset::id() const
122 void Inset::id(int id_arg)
127 void Inset::setFont(BufferView *, LyXFont const &, bool, bool)
131 bool Inset::forceDefaultParagraphs(Inset const * inset) const
134 return owner()->forceDefaultParagraphs(inset);
138 int Inset::latexTextWidth(BufferView * bv) const
141 return (owner()->latexTextWidth(bv));
142 return bv->workWidth();
146 int Inset::ascent(BufferView * bv, LyXFont const & font) const
149 dimension(bv, font, dim);
154 int Inset::descent(BufferView * bv, LyXFont const & font) const
157 dimension(bv, font, dim);
158 return dim.descent();
162 int Inset::width(BufferView * bv, LyXFont const & font) const
165 dimension(bv, font, dim);