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 // Inset::Inset(Inset const & in, bool same_id)
52 // top_x(0), top_baseline(0), scx(0), owner_(0),
53 // name_(in.name_), background_color_(in.background_color_)
62 bool Inset::directWrite() const
68 Inset::EDITABLE Inset::editable() const
74 void Inset::validate(LaTeXFeatures &) const
78 bool Inset::autoDelete() const
85 LyXFont const Inset::convertFont(LyXFont const & font) const
96 string const Inset::editMessage() const
98 return _("Opened inset");
102 LyXText * Inset::getLyXText(BufferView const * bv, bool const) const
105 return owner()->getLyXText(bv, false);
111 void Inset::setBackgroundColor(LColor::color color)
113 background_color_ = color;
117 LColor::color Inset::backgroundColor() const
119 if (background_color_ == LColor::inherit) {
121 return owner()->backgroundColor();
123 return LColor::background;
125 return background_color_;
129 int Inset::id() const
134 void Inset::id(int id_arg)
139 void Inset::setFont(BufferView *, LyXFont const &, bool, bool)
143 bool Inset::forceDefaultParagraphs(Inset const * inset) const
146 return owner()->forceDefaultParagraphs(inset);
150 int Inset::latexTextWidth(BufferView * bv) const
153 return (owner()->latexTextWidth(bv));
154 return bv->workWidth();
158 int Inset::ascent(BufferView * bv, LyXFont const & font) const
161 dimension(bv, font, dim);
166 int Inset::descent(BufferView * bv, LyXFont const & font) const
169 dimension(bv, font, dim);
170 return dim.descent();
174 int Inset::width(BufferView * bv, LyXFont const & font) const
177 dimension(bv, font, dim);