mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-23 00:38:01 +00:00
Remove redundant code and introduce InsetCollapsable::setLabelColor().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21380 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
876d88a86e
commit
12a3c703d1
@ -142,10 +142,6 @@ void InsetBox::read(Buffer const & buf, Lexer & lex)
|
|||||||
|
|
||||||
void InsetBox::setButtonLabel()
|
void InsetBox::setButtonLabel()
|
||||||
{
|
{
|
||||||
FontInfo font = sane_font;
|
|
||||||
font.decSize();
|
|
||||||
font.decSize();
|
|
||||||
|
|
||||||
BoxType btype = boxtranslator().find(params_.type);
|
BoxType btype = boxtranslator().find(params_.type);
|
||||||
|
|
||||||
docstring label;
|
docstring label;
|
||||||
@ -162,8 +158,7 @@ void InsetBox::setButtonLabel()
|
|||||||
|
|
||||||
setLabel(label);
|
setLabel(label);
|
||||||
|
|
||||||
font.setColor(Color_foreground);
|
setLabelColor(Color_foreground);
|
||||||
setLabelFont(font);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,6 +72,8 @@ public:
|
|||||||
///
|
///
|
||||||
void setLabelFont(FontInfo const & f);
|
void setLabelFont(FontInfo const & f);
|
||||||
///
|
///
|
||||||
|
void setLabelColor(ColorCode code);
|
||||||
|
///
|
||||||
bool isOpen() const { return geometry() != ButtonOnly; }
|
bool isOpen() const { return geometry() != ButtonOnly; }
|
||||||
///
|
///
|
||||||
CollapseStatus status() const;
|
CollapseStatus status() const;
|
||||||
|
@ -52,7 +52,6 @@ using std::string;
|
|||||||
void InsetERT::init()
|
void InsetERT::init()
|
||||||
{
|
{
|
||||||
setButtonLabel();
|
setButtonLabel();
|
||||||
|
|
||||||
// FIXME: what to do with those?
|
// FIXME: what to do with those?
|
||||||
//text_.current_font.setLanguage(latex_language);
|
//text_.current_font.setLanguage(latex_language);
|
||||||
//text_.real_current_font.setLanguage(latex_language);
|
//text_.real_current_font.setLanguage(latex_language);
|
||||||
|
@ -115,11 +115,6 @@ InsetFloat::InsetFloat(BufferParams const & bp, string const & type)
|
|||||||
: InsetCollapsable(bp), name_(from_utf8(type))
|
: InsetCollapsable(bp), name_(from_utf8(type))
|
||||||
{
|
{
|
||||||
setLabel(_("float: ") + floatName(type, bp));
|
setLabel(_("float: ") + floatName(type, bp));
|
||||||
FontInfo font = sane_font;
|
|
||||||
font.decSize();
|
|
||||||
font.decSize();
|
|
||||||
font.setColor(Color_collapsable);
|
|
||||||
setLabelFont(font);
|
|
||||||
params_.type = type;
|
params_.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,28 +65,36 @@ docstring const InsetHyperlink::getScreenLabel(Buffer const &) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void replaceAny(docstring & s, docstring const & items,
|
||||||
|
docstring const & replacement)
|
||||||
|
{
|
||||||
|
if (s.empty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
size_t i = 0;
|
||||||
|
while (i < s.size()) {
|
||||||
|
if ((i = s.find_first_of(items, i)) == string::npos)
|
||||||
|
break;
|
||||||
|
s.insert(i, replacement);
|
||||||
|
i += 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int InsetHyperlink::latex(Buffer const &, odocstream & os,
|
int InsetHyperlink::latex(Buffer const &, odocstream & os,
|
||||||
OutputParams const & runparams) const
|
OutputParams const & runparams) const
|
||||||
{
|
{
|
||||||
docstring url = getParam("target");
|
docstring url = getParam("target");
|
||||||
static docstring const backslash = from_ascii("\\");
|
static docstring const backslash = from_ascii("\\");
|
||||||
static docstring const braces = from_ascii("{}");
|
static docstring const braces = from_ascii("{}");
|
||||||
static char_type const chars_url[2] = {'%', '#'};
|
|
||||||
static char_type const chars_name[6] = {
|
static char_type const chars_name[6] = {
|
||||||
'&', '_', '$', '%', '#', '^'};
|
'&', '_', '$', '%', '#', '^'};
|
||||||
|
|
||||||
// The characters in chars_url[] need to be changed to a command when
|
// The characters in chars_url[] need to be changed to a command when
|
||||||
// they are in the url field.
|
// they are in the url field.
|
||||||
if (!url.empty()) {
|
// the chars_url[] characters must be handled for both, url and href
|
||||||
// the chars_url[] characters must be handled for both, url and href
|
static docstring const chars_url = from_ascii("%#");
|
||||||
for (int k = 0; k < 2; k++) {
|
replaceAny(url, chars_url, backslash);
|
||||||
for (size_t i = 0, pos;
|
|
||||||
(pos = url.find(chars_url[k], i)) != string::npos;
|
|
||||||
i = pos + 2) {
|
|
||||||
url.replace(pos, 1, backslash + chars_url[k]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} // end if (!url.empty())
|
|
||||||
|
|
||||||
docstring name = getParam("name");
|
docstring name = getParam("name");
|
||||||
|
|
||||||
|
@ -48,11 +48,8 @@ char const lstinline_delimiters[] =
|
|||||||
void InsetListings::init()
|
void InsetListings::init()
|
||||||
{
|
{
|
||||||
setButtonLabel();
|
setButtonLabel();
|
||||||
FontInfo font = sane_font;
|
layout_.labelfont.setColor(Color_none);
|
||||||
font.decSize();
|
|
||||||
font.decSize();
|
|
||||||
font.setColor(Color_none);
|
|
||||||
setLabelFont(font);
|
|
||||||
// FIXME: what to do with those?
|
// FIXME: what to do with those?
|
||||||
//text_.current_font.setLanguage(latex_language);
|
//text_.current_font.setLanguage(latex_language);
|
||||||
//text_.real_current_font.setLanguage(latex_language);
|
//text_.real_current_font.setLanguage(latex_language);
|
||||||
|
@ -24,9 +24,6 @@ namespace lyx {
|
|||||||
InsetOptArg::InsetOptArg(BufferParams const & ins)
|
InsetOptArg::InsetOptArg(BufferParams const & ins)
|
||||||
: InsetCollapsable(ins)
|
: InsetCollapsable(ins)
|
||||||
{
|
{
|
||||||
FontInfo font = sane_font;
|
|
||||||
font.setColor(Color_collapsable);
|
|
||||||
setLabelFont(font);
|
|
||||||
setLabel(_("opt"));
|
setLabel(_("opt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -34,9 +31,6 @@ InsetOptArg::InsetOptArg(BufferParams const & ins)
|
|||||||
InsetOptArg::InsetOptArg(InsetOptArg const & in)
|
InsetOptArg::InsetOptArg(InsetOptArg const & in)
|
||||||
: InsetCollapsable(in)
|
: InsetCollapsable(in)
|
||||||
{
|
{
|
||||||
FontInfo font = sane_font;
|
|
||||||
font.setColor(Color_collapsable);
|
|
||||||
setLabelFont(font);
|
|
||||||
setLabel(_("opt"));
|
setLabel(_("opt"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,11 +40,6 @@ Inset.heorem::InsetTheorem()
|
|||||||
: InsetCollapsable()
|
: InsetCollapsable()
|
||||||
{
|
{
|
||||||
setLabel(_("theorem"));
|
setLabel(_("theorem"));
|
||||||
FontInfo font = sane_font;
|
|
||||||
font.decSize();
|
|
||||||
font.decSize();
|
|
||||||
font.setColor(Color_collapsable);
|
|
||||||
setLabelFont(font);
|
|
||||||
#if 0
|
#if 0
|
||||||
setAutoCollapse(false);
|
setAutoCollapse(false);
|
||||||
#endif
|
#endif
|
||||||
|
@ -47,11 +47,6 @@ InsetWrap::InsetWrap(BufferParams const & bp, string const & type)
|
|||||||
: InsetCollapsable(bp), name_(from_utf8(type))
|
: InsetCollapsable(bp), name_(from_utf8(type))
|
||||||
{
|
{
|
||||||
setLabel(_("wrap: ") + floatName(type, bp));
|
setLabel(_("wrap: ") + floatName(type, bp));
|
||||||
FontInfo font = sane_font;
|
|
||||||
font.decSize();
|
|
||||||
font.decSize();
|
|
||||||
font.setColor(Color_collapsable);
|
|
||||||
setLabelFont(font);
|
|
||||||
params_.type = type;
|
params_.type = type;
|
||||||
params_.lines = 0;
|
params_.lines = 0;
|
||||||
params_.placement = "o";
|
params_.placement = "o";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user