mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-22 21:21:32 +00:00
parent
bb277747d2
commit
4ddc9e2501
@ -254,6 +254,10 @@ ColorSet::ColorSet()
|
||||
{ Color_command, N_("command inset"), "command", "black", "command" },
|
||||
{ Color_commandbg, N_("command inset background"), "commandbg", "azure", "commandbg" },
|
||||
{ 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_math, N_("math"), "math", "DarkBlue", "math" },
|
||||
{ Color_mathbg, N_("math background"), "mathbg", "linen", "mathbg" },
|
||||
|
@ -207,8 +207,16 @@ enum ColorCode {
|
||||
Color_buttonframe,
|
||||
/// Color used for bottom background
|
||||
Color_buttonbg,
|
||||
/// Color used for buttom under focus
|
||||
/// Color used for button under focus
|
||||
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_paragraphmarker,
|
||||
/// Preview frame color
|
||||
|
@ -364,11 +364,19 @@ docstring InsetCitation::complexLabel(bool for_xhtml) const
|
||||
if (!buf.isFullyLoaded())
|
||||
return docstring();
|
||||
|
||||
docstring const & key = getParam("key");
|
||||
|
||||
BiblioInfo const & biblist = buf.masterBibInfo();
|
||||
|
||||
// mark broken citations
|
||||
if (biblist.empty() || biblist.find(key) == biblist.end())
|
||||
setBroken(true);
|
||||
else
|
||||
setBroken(false);
|
||||
|
||||
if (biblist.empty())
|
||||
return docstring();
|
||||
|
||||
docstring const & key = getParam("key");
|
||||
if (key.empty())
|
||||
return _("No citations selected!");
|
||||
|
||||
|
@ -60,14 +60,14 @@ namespace lyx {
|
||||
// FIXME Would it now be possible to use the InsetCode in
|
||||
// place of the mailer name and recover that information?
|
||||
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
|
||||
// that the mouse_hover_ map is not copied and remains empty.
|
||||
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_;
|
||||
mouse_hover_.clear();
|
||||
button_ = RenderButton();
|
||||
broken_ = false;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -101,7 +102,7 @@ InsetCommand::~InsetCommand()
|
||||
void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
button_.update(screenLabel(), editable() || clickable(*mi.base.bv, 0, 0),
|
||||
inheritFont());
|
||||
inheritFont(), broken_);
|
||||
button_.metrics(mi, dim);
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,8 @@ public:
|
||||
void setParam(std::string const & name, docstring const & value);
|
||||
/// FIXME Remove
|
||||
docstring const getFirstNonOptParam() const { return p_.getFirstNonOptParam(); }
|
||||
///
|
||||
void setBroken(bool const b) const { broken_ = b; }
|
||||
|
||||
/// \name Public functions inherited from Inset class
|
||||
//@{
|
||||
@ -147,6 +149,8 @@ private:
|
||||
mutable std::map<BufferView const *, bool> mouse_hover_;
|
||||
///
|
||||
mutable RenderButton button_;
|
||||
///
|
||||
mutable bool broken_;
|
||||
};
|
||||
|
||||
/// Decode InsetCommand considering Inset name and data.
|
||||
|
@ -1186,7 +1186,7 @@ void InsetInclude::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
} else {
|
||||
if (!set_label_) {
|
||||
set_label_ = true;
|
||||
button_.update(screenLabel(), true, false);
|
||||
button_.update(screenLabel(), true, false, !file_exist_);
|
||||
}
|
||||
button_.metrics(mi, dim);
|
||||
}
|
||||
@ -1377,7 +1377,7 @@ void InsetInclude::updateBuffer(ParIterator const & it, UpdateType utype, bool c
|
||||
{
|
||||
file_exist_ = includedFileExist();
|
||||
|
||||
button_.update(screenLabel(), true, false);
|
||||
button_.update(screenLabel(), true, false, !file_exist_);
|
||||
|
||||
Buffer const * const childbuffer = getChildBuffer();
|
||||
if (childbuffer) {
|
||||
|
@ -443,6 +443,7 @@ void InsetRef::updateBuffer(ParIterator const & it, UpdateType, bool const /*del
|
||||
|
||||
screen_label_ = label;
|
||||
broken_ = false;
|
||||
setBroken(broken_);
|
||||
}
|
||||
|
||||
|
||||
@ -458,6 +459,7 @@ void InsetRef::addToToc(DocIterator const & cpit, bool output_active,
|
||||
docstring const & label = getParam("reference");
|
||||
if (buffer().insetLabel(label)) {
|
||||
broken_ = !buffer().activeLabel(label);
|
||||
setBroken(broken_);
|
||||
// This InsetRef has already been taken care of in InsetLabel::addToToc().
|
||||
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.
|
||||
|
||||
broken_ = true;
|
||||
setBroken(broken_);
|
||||
shared_ptr<Toc> toc = backend.toc("label");
|
||||
toc->push_back(TocItem(cpit, 0, screenLabel(), output_active));
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ namespace lyx {
|
||||
|
||||
|
||||
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,
|
||||
bool inherit)
|
||||
bool inherit, bool broken)
|
||||
{
|
||||
text_ = text;
|
||||
editable_ = editable;
|
||||
inherit_font_ = inherit;
|
||||
broken_ = broken;
|
||||
}
|
||||
|
||||
|
||||
@ -60,7 +61,12 @@ void RenderButton::draw(PainterInfo & pi, int x, int y) const
|
||||
font.setColor(Color_command);
|
||||
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,
|
||||
renderState() ? Color_buttonhoverbg : Color_buttonbg,
|
||||
Color_buttonframe, Inset::textOffset(pi.base.bv));
|
||||
|
@ -33,7 +33,8 @@ public:
|
||||
virtual void draw(PainterInfo & pi, int x, int y) const;
|
||||
|
||||
/// 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
|
||||
Box box() const { return button_box_; }
|
||||
@ -47,6 +48,7 @@ private:
|
||||
/// The stored data.
|
||||
docstring text_;
|
||||
bool editable_;
|
||||
bool broken_;
|
||||
bool inherit_font_;
|
||||
Box button_box_;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user