]> git.lyx.org Git - lyx.git/blob - src/insets/inset.C
small clenaup
[lyx.git] / src / insets / inset.C
1 /**
2  * \file inset.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author Jürgen Vigna
8  * \author Lars Gullik Bjønnes
9  * \author Matthias Ettrich
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #include <config.h>
15
16 #include "inset.h"
17 #include "updatableinset.h"
18
19 #include "BufferView.h"
20 #include "gettext.h"
21 #include "LColor.h"
22
23
24 using std::string;
25
26
27 InsetOld::InsetOld()
28         : InsetBase(),
29         xo_(0), yo_(0), scx(0), owner_(0),
30         background_color_(LColor::inherit)
31 {}
32
33
34 InsetOld::InsetOld(InsetOld const & in)
35         : InsetBase(),
36         xo_(0), yo_(0), scx(0), owner_(0),
37         name_(in.name_), background_color_(in.background_color_)
38 {}
39
40
41 bool InsetOld::directWrite() const
42 {
43         return false;
44 }
45
46
47 InsetOld::EDITABLE InsetOld::editable() const
48 {
49         return NOT_EDITABLE;
50 }
51
52
53 bool InsetOld::autoDelete() const
54 {
55         return false;
56 }
57
58
59 #if 0
60 LyXFont const InsetOld::convertFont(LyXFont const & font) const
61 {
62 #if 1
63         return font;
64 #else
65         return LyXFont(font);
66 #endif
67 }
68 #endif
69
70
71 string const InsetOld::editMessage() const
72 {
73         return _("Opened inset");
74 }
75
76
77 void InsetOld::setBackgroundColor(LColor_color color)
78 {
79         background_color_ = color;
80 }
81
82
83 LColor_color InsetOld::backgroundColor() const
84 {
85         if (background_color_ == LColor::inherit) {
86                 if (owner())
87                         return owner()->backgroundColor();
88                 else
89                         return LColor::background;
90         } else
91                 return LColor::color(background_color_);
92 }
93
94
95 void InsetOld::setFont(BufferView *, LyXFont const &, bool, bool)
96 {}
97
98
99 bool InsetOld::forceDefaultParagraphs(InsetOld const * inset) const
100 {
101         if (owner())
102                 return owner()->forceDefaultParagraphs(inset);
103         return false;
104 }
105
106 int InsetOld::latexTextWidth(BufferView * bv) const
107 {
108         if (owner())
109                 return (owner()->latexTextWidth(bv));
110         return bv->workWidth();
111 }
112
113
114 int InsetOld::ascent() const
115 {
116         return dim_.asc;
117 }
118
119
120 int InsetOld::descent() const
121 {
122         return dim_.des;
123 }
124
125
126 int InsetOld::width() const
127 {
128         return dim_.wid;
129 }
130
131
132 bool InsetOld::insetAllowed(InsetOld * in) const
133 {
134         return insetAllowed(in->lyxCode());
135 }
136
137
138 bool InsetOld::checkInsertChar(LyXFont &)
139 {
140         return false;
141 }
142
143
144 int InsetOld::scroll(bool recursive) const
145 {
146         if (!recursive || !owner_)
147                 return scx;
148         return 0;
149 }
150
151 bool isEditableInset(InsetOld const * i)
152 {
153         return i && i->editable();
154 }
155
156
157 bool isHighlyEditableInset(InsetOld const * i)
158 {
159         return i && i->editable() == InsetOld::HIGHLY_EDITABLE;
160 }