mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Remove background_color_ in Insets: it takes a lot of unnecessary memory,
especially in math where each equation has many insets. * src/Insets.cpp: remove background_color_ member (setBackgroundColor): remove (backgroundColor): make virtual * insets/InsetBranch.cpp: * insets/InsetNote.cpp: move color setting code from setButtonLabel to backgroundColor. * insets/InsetBox.cpp (setButtonLabel): remove call to setBackgroundColor. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18750 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
37333444c0
commit
4ba4d701f7
@ -117,7 +117,7 @@ static TranslatorMap const build_translator()
|
||||
|
||||
/// pretty arbitrary dimensions
|
||||
Inset::Inset()
|
||||
: dim_(10, 10, 10), background_color_(Color::background)
|
||||
: dim_(10, 10, 10)
|
||||
{}
|
||||
|
||||
|
||||
@ -351,15 +351,9 @@ void Inset::dump() const
|
||||
}
|
||||
|
||||
|
||||
void Inset::setBackgroundColor(Color_color color)
|
||||
{
|
||||
background_color_ = color;
|
||||
}
|
||||
|
||||
|
||||
Color_color Inset::backgroundColor() const
|
||||
{
|
||||
return Color::color(background_color_);
|
||||
return Color::background;
|
||||
}
|
||||
|
||||
|
||||
|
@ -470,9 +470,7 @@ public:
|
||||
///
|
||||
int scroll() const { return 0; }
|
||||
///
|
||||
void setBackgroundColor(Color_color);
|
||||
///
|
||||
Color_color backgroundColor() const;
|
||||
virtual Color_color backgroundColor() const;
|
||||
///
|
||||
enum CollapseStatus {
|
||||
Collapsed,
|
||||
@ -504,10 +502,6 @@ protected:
|
||||
mutable Dimension dim_;
|
||||
private:
|
||||
virtual std::auto_ptr<Inset> doClone() const = 0;
|
||||
/** We store the Color::color value as an int to get Color.h out
|
||||
* of the header file.
|
||||
*/
|
||||
int background_color_;
|
||||
};
|
||||
|
||||
|
||||
|
@ -164,7 +164,6 @@ void InsetBox::setButtonLabel()
|
||||
setLabel(label);
|
||||
|
||||
font.setColor(Color::foreground);
|
||||
setBackgroundColor(Color::background);
|
||||
setLabelFont(font);
|
||||
}
|
||||
|
||||
|
@ -98,19 +98,30 @@ void InsetBranch::setButtonLabel()
|
||||
font.decSize();
|
||||
|
||||
docstring s = _("Branch: ") + params_.branch;
|
||||
if (!params_.branch.empty()) {
|
||||
// FIXME UNICODE
|
||||
Color_color c = lcolor.getFromLyXName(to_utf8(params_.branch));
|
||||
if (c == Color::none) {
|
||||
s = _("Undef: ") + s;
|
||||
}
|
||||
}
|
||||
font.setColor(Color::foreground);
|
||||
setLabel(isOpen() ? s : getNewLabel(s) );
|
||||
setLabelFont(font);
|
||||
}
|
||||
|
||||
|
||||
Color_color InsetBranch::backgroundColor() const
|
||||
{
|
||||
if (!params_.branch.empty()) {
|
||||
// FIXME UNICODE
|
||||
Color_color c = lcolor.getFromLyXName(to_utf8(params_.branch));
|
||||
if (c == Color::none) {
|
||||
c = Color::error;
|
||||
s = _("Undef: ") + s;
|
||||
}
|
||||
setBackgroundColor(c);
|
||||
return c;
|
||||
} else
|
||||
setBackgroundColor(Color::background);
|
||||
setLabel(isOpen() ? s : getNewLabel(s) );
|
||||
setLabelFont(font);
|
||||
return Inset::backgroundColor();
|
||||
}
|
||||
|
||||
|
||||
|
@ -53,6 +53,8 @@ public:
|
||||
///
|
||||
void setButtonLabel();
|
||||
///
|
||||
virtual Color_color backgroundColor() const;
|
||||
///
|
||||
bool showInsetDialog(BufferView *) const;
|
||||
///
|
||||
int latex(Buffer const &, odocstream &,
|
||||
|
@ -186,32 +186,53 @@ void InsetNote::setButtonLabel()
|
||||
font.decSize();
|
||||
font.decSize();
|
||||
|
||||
Color_color c;
|
||||
switch (params_.type) {
|
||||
case InsetNoteParams::Note:
|
||||
font.setColor(Color::note);
|
||||
setBackgroundColor(Color::notebg);
|
||||
c = Color::note;
|
||||
break;
|
||||
case InsetNoteParams::Comment:
|
||||
font.setColor(Color::comment);
|
||||
setBackgroundColor(Color::commentbg);
|
||||
c = Color::comment;
|
||||
break;
|
||||
case InsetNoteParams::Greyedout:
|
||||
font.setColor(Color::greyedout);
|
||||
setBackgroundColor(Color::greyedoutbg);
|
||||
c = Color::greyedout;
|
||||
break;
|
||||
case InsetNoteParams::Framed:
|
||||
font.setColor(Color::greyedout);
|
||||
setBackgroundColor(Color::greyedoutbg);
|
||||
c = Color::greyedout;
|
||||
break;
|
||||
case InsetNoteParams::Shaded:
|
||||
font.setColor(Color::greyedout);
|
||||
setBackgroundColor(Color::shadedbg);
|
||||
c = Color::greyedout;
|
||||
break;
|
||||
}
|
||||
font.setColor(c);
|
||||
setLabelFont(font);
|
||||
}
|
||||
|
||||
|
||||
Color_color InsetNote::backgroundColor() const
|
||||
{
|
||||
Color_color c;
|
||||
switch (params_.type) {
|
||||
case InsetNoteParams::Note:
|
||||
c = Color::notebg;
|
||||
break;
|
||||
case InsetNoteParams::Comment:
|
||||
c = Color::commentbg;
|
||||
break;
|
||||
case InsetNoteParams::Greyedout:
|
||||
c = Color::greyedoutbg;
|
||||
break;
|
||||
case InsetNoteParams::Framed:
|
||||
c = Color::greyedoutbg;
|
||||
break;
|
||||
case InsetNoteParams::Shaded:
|
||||
c = Color::shadedbg;
|
||||
break;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
bool InsetNote::showInsetDialog(BufferView * bv) const
|
||||
{
|
||||
InsetNoteMailer(const_cast<InsetNote &>(*this)).showDialog(bv);
|
||||
|
@ -61,6 +61,8 @@ public:
|
||||
void read(Buffer const & buf, Lexer & lex);
|
||||
///
|
||||
void setButtonLabel();
|
||||
///
|
||||
virtual Color_color backgroundColor() const;
|
||||
/// show the note dialog
|
||||
bool showInsetDialog(BufferView * bv) const;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user