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)
45 top_x(0), top_baseline(0), scx(0), owner_(0),
46 name_(in.name_), background_color_(in.background_color_)
52 // Inset::Inset(Inset const & in, bool same_id)
54 // top_x(0), top_baseline(0), scx(0), owner_(0),
55 // name_(in.name_), background_color_(in.background_color_)
64 bool Inset::directWrite() const
70 Inset::EDITABLE Inset::editable() const
76 void Inset::validate(LaTeXFeatures &) const
80 bool Inset::autoDelete() const
87 LyXFont const Inset::convertFont(LyXFont const & font) const
98 string const Inset::editMessage() const
100 return _("Opened inset");
104 LyXText * Inset::getLyXText(BufferView const * bv, bool const) const
107 return owner()->getLyXText(bv, false);
113 void Inset::setBackgroundColor(LColor::color color)
115 background_color_ = color;
119 LColor::color Inset::backgroundColor() const
121 if (background_color_ == LColor::inherit) {
123 return owner()->backgroundColor();
125 return LColor::background;
127 return background_color_;
131 int Inset::id() const
136 void Inset::id(int id_arg)
141 void Inset::setFont(BufferView *, LyXFont const &, bool, bool)
145 bool Inset::forceDefaultParagraphs(Inset const * inset) const
148 return owner()->forceDefaultParagraphs(inset);
152 int Inset::latexTextWidth(BufferView * bv) const
155 return (owner()->latexTextWidth(bv));
156 return bv->workWidth();
160 int Inset::ascent(BufferView * bv, LyXFont const & font) const
163 dimension(bv, font, dim);
168 int Inset::descent(BufferView * bv, LyXFont const & font) const
171 dimension(bv, font, dim);
172 return dim.descent();
176 int Inset::width(BufferView * bv, LyXFont const & font) const
179 dimension(bv, font, dim);