mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
Pass a BufferView to Inset::clickable
This commit is contained in:
parent
9fc27f6bb7
commit
815e6c9f2f
@ -2124,7 +2124,7 @@ void BufferView::updateHoveredInset() const
|
||||
int const y = d->mouse_position_cache_.y_;
|
||||
Inset const * covering_inset = getCoveringInset(buffer_.text(), x, y);
|
||||
|
||||
d->clickable_inset_ = covering_inset && covering_inset->clickable(x, y);
|
||||
d->clickable_inset_ = covering_inset && covering_inset->clickable(*this, x, y);
|
||||
|
||||
if (covering_inset == d->last_inset_)
|
||||
// Same inset, no need to do anything...
|
||||
|
@ -350,7 +350,7 @@ void Inset::doDispatch(Cursor & cur, FuncRequest &cmd)
|
||||
// if the derived inset did not explicitly handle mouse_release,
|
||||
// we assume we request the settings dialog
|
||||
if (!cur.selection() && cmd.button() == mouse_button::button1
|
||||
&& clickable(cmd.x(), cmd.y()) && hasSettings()) {
|
||||
&& clickable(cur.bv(), cmd.x(), cmd.y()) && hasSettings()) {
|
||||
FuncRequest tmpcmd(LFUN_INSET_SETTINGS);
|
||||
dispatch(cur, tmpcmd);
|
||||
}
|
||||
|
@ -344,7 +344,7 @@ public:
|
||||
// true for InsetTabular & InsetText
|
||||
virtual bool isActive() const { return nargs() > 0; }
|
||||
/// can we click at the specified position ?
|
||||
virtual bool clickable(int, int) const { return false; }
|
||||
virtual bool clickable(BufferView const &, int, int) const { return false; }
|
||||
/// Move one cell backwards
|
||||
virtual bool allowsCaptionVariation(std::string const &) const { return false; }
|
||||
|
||||
|
@ -414,7 +414,7 @@ bool InsetCollapsable::hitButton(FuncRequest const & cmd) const
|
||||
}
|
||||
|
||||
|
||||
bool InsetCollapsable::clickable(int x, int y) const
|
||||
bool InsetCollapsable::clickable(BufferView const &, int x, int y) const
|
||||
{
|
||||
FuncRequest cmd(LFUN_NOACTION, x, y, mouse_button::none);
|
||||
return hitButton(cmd);
|
||||
|
@ -69,7 +69,7 @@ public:
|
||||
///
|
||||
bool hasSettings() const { return true; }
|
||||
///
|
||||
bool clickable(int x, int y) const;
|
||||
bool clickable(BufferView const &, int x, int y) const;
|
||||
/// can we go further down on mouse click?
|
||||
bool descendable(BufferView const & bv) const;
|
||||
///
|
||||
|
@ -94,7 +94,7 @@ InsetCommand::~InsetCommand()
|
||||
|
||||
void InsetCommand::metrics(MetricsInfo & mi, Dimension & dim) const
|
||||
{
|
||||
button_.update(screenLabel(), editable() || clickable(0, 0));
|
||||
button_.update(screenLabel(), editable() || clickable(*mi.base.bv, 0, 0));
|
||||
button_.metrics(mi, dim);
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
///
|
||||
bool setMouseHover(BufferView const * bv, bool mouse_hover) const;
|
||||
///
|
||||
bool clickable(int, int) const { return hasSettings(); }
|
||||
bool clickable(BufferView const &, int, int) const { return hasSettings(); }
|
||||
//@}
|
||||
|
||||
protected:
|
||||
|
@ -118,7 +118,7 @@ public:
|
||||
///
|
||||
bool setMouseHover(BufferView const * bv, bool mouse_hover) const;
|
||||
///
|
||||
bool clickable(int, int) const { return true; }
|
||||
bool clickable(BufferView const &, int, int) const { return true; }
|
||||
///
|
||||
void addToToc(DocIterator const & di, bool output_active,
|
||||
UpdateType utype) const;
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
///
|
||||
bool clickable(int, int) const { return true; }
|
||||
bool clickable(BufferView const &, int, int) const { return true; }
|
||||
///
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
//@}
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
InsetGraphicsParams getParams() const { return params_;}
|
||||
///
|
||||
bool clickable(int, int) const { return true; }
|
||||
bool clickable(BufferView const &, int, int) const { return true; }
|
||||
|
||||
private:
|
||||
///
|
||||
|
@ -139,7 +139,7 @@ public:
|
||||
///
|
||||
bool hasSettings() const { return true; }
|
||||
///
|
||||
bool clickable(int, int) const { return true; }
|
||||
bool clickable(BufferView const &, int, int) const { return true; }
|
||||
///
|
||||
InsetCode lyxCode() const { return SPACE_CODE; }
|
||||
/// does this inset try to use all available space (like \\hfill does)?
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
///
|
||||
bool clickable(int, int) const { return true; }
|
||||
bool clickable(BufferView const &, int, int) const { return true; }
|
||||
//@}
|
||||
|
||||
/// \name Static public methods obligated for InsetCommand derived classes
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
///
|
||||
bool hasSettings() const { return true; }
|
||||
///
|
||||
bool clickable(int, int) const { return true; }
|
||||
bool clickable(BufferView const &, int, int) const { return true; }
|
||||
///
|
||||
std::string contextMenuName() const;
|
||||
///
|
||||
|
Loading…
Reference in New Issue
Block a user