mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 10:47:57 +00:00
parent
bb277747d2
commit
4ddc9e2501
@ -254,6 +254,10 @@ ColorSet::ColorSet()
|
|||||||
{ Color_command, N_("command inset"), "command", "black", "command" },
|
{ Color_command, N_("command inset"), "command", "black", "command" },
|
||||||
{ Color_commandbg, N_("command inset background"), "commandbg", "azure", "commandbg" },
|
{ Color_commandbg, N_("command inset background"), "commandbg", "azure", "commandbg" },
|
||||||
{ Color_commandframe, N_("command inset frame"), "commandframe", "black", "commandframe" },
|
{ Color_commandframe, N_("command inset frame"), "commandframe", "black", "commandframe" },
|
||||||
|
{ Color_command_broken, N_("command inset (broken reference)"), "command", "white", "command" },
|
||||||
|
{ Color_buttonbg_broken, N_("button background (broken reference)"), "commandbg", "Red", "commandbg_broken" },
|
||||||
|
{ Color_buttonframe_broken, N_("button frame (broken reference)"), "commandframe", "Red", "commandframe_broken" },
|
||||||
|
{ Color_buttonhoverbg_broken, N_("button background (broken reference) under focus"), "buttonhoverbg", "#DB0B0B", "buttonhoverbg_broken" },
|
||||||
{ Color_special, N_("special character"), "special", "RoyalBlue", "special" },
|
{ Color_special, N_("special character"), "special", "RoyalBlue", "special" },
|
||||||
{ Color_math, N_("math"), "math", "DarkBlue", "math" },
|
{ Color_math, N_("math"), "math", "DarkBlue", "math" },
|
||||||
{ Color_mathbg, N_("math background"), "mathbg", "linen", "mathbg" },
|
{ Color_mathbg, N_("math background"), "mathbg", "linen", "mathbg" },
|
||||||
|
@ -207,8 +207,16 @@ enum ColorCode {
|
|||||||
Color_buttonframe,
|
Color_buttonframe,
|
||||||
/// Color used for bottom background
|
/// Color used for bottom background
|
||||||
Color_buttonbg,
|
Color_buttonbg,
|
||||||
/// Color used for buttom under focus
|
/// Color used for button under focus
|
||||||
Color_buttonhoverbg,
|
Color_buttonhoverbg,
|
||||||
|
/// Text color for broken insets
|
||||||
|
Color_command_broken,
|
||||||
|
/// Background color for broken insets
|
||||||
|
Color_buttonbg_broken,
|
||||||
|
/// Frame color for broken insets
|
||||||
|
Color_buttonframe_broken,
|
||||||
|
/// Color used for broken inset button under focus
|
||||||
|
Color_buttonhoverbg_broken,
|
||||||
/// Color used for the pilcrow sign to mark the end of a paragraph
|
/// Color used for the pilcrow sign to mark the end of a paragraph
|
||||||
Color_paragraphmarker,
|
Color_paragraphmarker,
|
||||||
/// Preview frame color
|
/// Preview frame color
|
||||||
|
@ -364,11 +364,19 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
|
|||||||
if (!buf.isFullyLoaded())
|
if (!buf.isFullyLoaded())
|
||||||
return docstring();
|
return docstring();
|
||||||
|
|
||||||
|
docstring const & key = getParam("key");
|
||||||
|
|
||||||
BiblioInfo const & biblist = buf.masterBibInfo();
|
BiblioInfo const & biblist = buf.masterBibInfo();
|
||||||
|
|
||||||
|
// mark broken citations
|
||||||
|
if (biblist.empty() || biblist.find(key) == biblist.end())
|
||||||
|
setBroken(true);
|
||||||
|
else
|
||||||
|
setBroken(false);
|
||||||
|
|
||||||
if (biblist.empty())
|
if (biblist.empty())
|
||||||
return docstring();
|
return docstring();
|
||||||
|
|
||||||
docstring const & key = getParam("key");
|
|
||||||
if (key.empty())
|
if (key.empty())
|
||||||
return _("No citations selected!");
|
return _("No citations selected!");
|
||||||
|
|
||||||
|
@ -60,14 +60,14 @@ namespace lyx {
|
|||||||
// FIXME Would it now be possible to use the InsetCode in
|
// FIXME Would it now be possible to use the InsetCode in
|
||||||
// place of the mailer name and recover that information?
|
// place of the mailer name and recover that information?
|
||||||
InsetCommand::InsetCommand(Buffer * buf, InsetCommandParams const & p)
|
InsetCommand::InsetCommand(Buffer * buf, InsetCommandParams const & p)
|
||||||
: Inset(buf), p_(p)
|
: Inset(buf), p_(p), broken_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
// The sole purpose of this copy constructor is to make sure
|
// The sole purpose of this copy constructor is to make sure
|
||||||
// that the mouse_hover_ map is not copied and remains empty.
|
// that the mouse_hover_ map is not copied and remains empty.
|
||||||
InsetCommand::InsetCommand(InsetCommand const & rhs)
|
InsetCommand::InsetCommand(InsetCommand const & rhs)
|
||||||
: Inset(rhs), p_(rhs.p_)
|
: Inset(rhs), p_(rhs.p_), broken_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -80,6 +80,7 @@ InsetCommand & InsetCommand::operator=(InsetCommand const & rhs)
|
|||||||
p_ = rhs.p_;
|
p_ = rhs.p_;
|
||||||
mouse_hover_.clear();
|
mouse_hover_.clear();
|
||||||
button_ = RenderButton();
|
button_ = RenderButton();
|
||||||
|
broken_ = false;
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -101,7 +102,7 @@ InsetCommand::~InsetCommand()
|
|||||||
void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
|
void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||||
{
|
{
|
||||||
button_.update(screenLabel(), editable() || clickable(*mi.base.bv, 0, 0),
|
button_.update(screenLabel(), editable() || clickable(*mi.base.bv, 0, 0),
|
||||||
inheritFont());
|
inheritFont(), broken_);
|
||||||
button_.metrics(mi, dim);
|
button_.metrics(mi, dim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,6 +62,8 @@ public:
|
|||||||
void setParam(std::string const & name, docstring const & value);
|
void setParam(std::string const & name, docstring const & value);
|
||||||
/// FIXME Remove
|
/// FIXME Remove
|
||||||
docstring const getFirstNonOptParam() const { return p_.getFirstNonOptParam(); }
|
docstring const getFirstNonOptParam() const { return p_.getFirstNonOptParam(); }
|
||||||
|
///
|
||||||
|
void setBroken(bool const b) const { broken_ = b; }
|
||||||
|
|
||||||
/// \name Public functions inherited from Inset class
|
/// \name Public functions inherited from Inset class
|
||||||
//@{
|
//@{
|
||||||
@ -147,6 +149,8 @@ private:
|
|||||||
mutable std::map<BufferView const *, bool> mouse_hover_;
|
mutable std::map<BufferView const *, bool> mouse_hover_;
|
||||||
///
|
///
|
||||||
mutable RenderButton button_;
|
mutable RenderButton button_;
|
||||||
|
///
|
||||||
|
mutable bool broken_;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Decode InsetCommand considering Inset name and data.
|
/// Decode InsetCommand considering Inset name and data.
|
||||||
|
@ -1186,7 +1186,7 @@ void InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const
|
|||||||
} else {
|
} else {
|
||||||
if (!set_label_) {
|
if (!set_label_) {
|
||||||
set_label_ = true;
|
set_label_ = true;
|
||||||
button_.update(screenLabel(), true, false);
|
button_.update(screenLabel(), true, false, !file_exist_);
|
||||||
}
|
}
|
||||||
button_.metrics(mi, dim);
|
button_.metrics(mi, dim);
|
||||||
}
|
}
|
||||||
@ -1377,7 +1377,7 @@ void InsetInclude::updateBuffer(ParIterator const & it, UpdateType utype, bool c
|
|||||||
{
|
{
|
||||||
file_exist_ = includedFileExist();
|
file_exist_ = includedFileExist();
|
||||||
|
|
||||||
button_.update(screenLabel(), true, false);
|
button_.update(screenLabel(), true, false, !file_exist_);
|
||||||
|
|
||||||
Buffer const * const childbuffer = getChildBuffer();
|
Buffer const * const childbuffer = getChildBuffer();
|
||||||
if (childbuffer) {
|
if (childbuffer) {
|
||||||
|
@ -443,6 +443,7 @@ void InsetRef::updateBuffer(ParIterator const & it, UpdateType, bool const /*del
|
|||||||
|
|
||||||
screen_label_ = label;
|
screen_label_ = label;
|
||||||
broken_ = false;
|
broken_ = false;
|
||||||
|
setBroken(broken_);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -458,6 +459,7 @@ void InsetRef::addToToc(DocIterator const & cpit, bool output_active,
|
|||||||
docstring const & label = getParam("reference");
|
docstring const & label = getParam("reference");
|
||||||
if (buffer().insetLabel(label)) {
|
if (buffer().insetLabel(label)) {
|
||||||
broken_ = !buffer().activeLabel(label);
|
broken_ = !buffer().activeLabel(label);
|
||||||
|
setBroken(broken_);
|
||||||
// This InsetRef has already been taken care of in InsetLabel::addToToc().
|
// This InsetRef has already been taken care of in InsetLabel::addToToc().
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -465,6 +467,7 @@ void InsetRef::addToToc(DocIterator const & cpit, bool output_active,
|
|||||||
// It seems that this reference does not point to any valid label.
|
// It seems that this reference does not point to any valid label.
|
||||||
|
|
||||||
broken_ = true;
|
broken_ = true;
|
||||||
|
setBroken(broken_);
|
||||||
shared_ptr<Toc> toc = backend.toc("label");
|
shared_ptr<Toc> toc = backend.toc("label");
|
||||||
toc->push_back(TocItem(cpit, 0, screenLabel(), output_active));
|
toc->push_back(TocItem(cpit, 0, screenLabel(), output_active));
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ namespace lyx {
|
|||||||
|
|
||||||
|
|
||||||
RenderButton::RenderButton()
|
RenderButton::RenderButton()
|
||||||
: editable_(false), inherit_font_(false)
|
: editable_(false), broken_(false), inherit_font_(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -33,11 +33,12 @@ RenderBase * RenderButton::clone(Inset const *) const
|
|||||||
|
|
||||||
|
|
||||||
void RenderButton::update(docstring const & text, bool editable,
|
void RenderButton::update(docstring const & text, bool editable,
|
||||||
bool inherit)
|
bool inherit, bool broken)
|
||||||
{
|
{
|
||||||
text_ = text;
|
text_ = text;
|
||||||
editable_ = editable;
|
editable_ = editable;
|
||||||
inherit_font_ = inherit;
|
inherit_font_ = inherit;
|
||||||
|
broken_ = broken;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -60,7 +61,12 @@ void RenderButton::draw(PainterInfo & pi, int x, int y) const
|
|||||||
font.setColor(Color_command);
|
font.setColor(Color_command);
|
||||||
font.decSize();
|
font.decSize();
|
||||||
|
|
||||||
if (editable_) {
|
if (broken_) {
|
||||||
|
font.setColor(Color_command_broken);
|
||||||
|
pi.pain.buttonText(x, y, text_, font,
|
||||||
|
renderState() ? Color_buttonhoverbg_broken : Color_buttonbg_broken,
|
||||||
|
Color_buttonframe_broken, Inset::textOffset(pi.base.bv));
|
||||||
|
} else if (editable_) {
|
||||||
pi.pain.buttonText(x, y, text_, font,
|
pi.pain.buttonText(x, y, text_, font,
|
||||||
renderState() ? Color_buttonhoverbg : Color_buttonbg,
|
renderState() ? Color_buttonhoverbg : Color_buttonbg,
|
||||||
Color_buttonframe, Inset::textOffset(pi.base.bv));
|
Color_buttonframe, Inset::textOffset(pi.base.bv));
|
||||||
|
@ -33,7 +33,8 @@ public:
|
|||||||
virtual void draw(PainterInfo & pi, int x, int y) const;
|
virtual void draw(PainterInfo & pi, int x, int y) const;
|
||||||
|
|
||||||
/// Provide the text for the button
|
/// Provide the text for the button
|
||||||
void update(docstring const &, bool editable, bool inherit);
|
void update(docstring const &, bool editable,
|
||||||
|
bool inherit, bool broken = false);
|
||||||
|
|
||||||
/// The "sensitive area" box, i.e., the button area
|
/// The "sensitive area" box, i.e., the button area
|
||||||
Box box() const { return button_box_; }
|
Box box() const { return button_box_; }
|
||||||
@ -47,6 +48,7 @@ private:
|
|||||||
/// The stored data.
|
/// The stored data.
|
||||||
docstring text_;
|
docstring text_;
|
||||||
bool editable_;
|
bool editable_;
|
||||||
|
bool broken_;
|
||||||
bool inherit_font_;
|
bool inherit_font_;
|
||||||
Box button_box_;
|
Box button_box_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user