mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-10 18:58:10 +00:00
Rename InsetXXX::contextMenu to InsetXXX::contextMenuName. Now this function doesn't need all the parameters and we split the functionality of choosing which context menu to return, from the functionality of supplying the name for the Inset itself. Now, the InsetText context menu is returned for InsetCollapsables when the button is not hit by the mouse. There is no (intended) change in functionality for insets without a button, collapsed insets. This fixes partly bug #6642. A fix for InsetTabular and for insets with no button will follow.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36604 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
5eb7add409
commit
e7f2bbe1ee
@ -255,6 +255,12 @@ docstring Inset::toolTip(BufferView const &, int, int) const
|
||||
|
||||
|
||||
docstring Inset::contextMenu(BufferView const &, int, int) const
|
||||
{
|
||||
return contextMenuName();
|
||||
}
|
||||
|
||||
|
||||
docstring Inset::contextMenuName() const
|
||||
{
|
||||
return docstring();
|
||||
}
|
||||
|
@ -400,9 +400,14 @@ public:
|
||||
/// This default implementation returns an empty string.
|
||||
virtual docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||
|
||||
/// \return Context menu identifier. This function determines
|
||||
/// whose Inset's menu should be shown for the given position.
|
||||
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
|
||||
/// \return Context menu identifier for this inset.
|
||||
/// This default implementation returns an empty string.
|
||||
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
virtual docstring contextMenuName() const;
|
||||
|
||||
|
||||
// FIXME This should really disappear in favor of
|
||||
// docstring name() const { return from_ascii(insetName(lyxCode()))); }
|
||||
|
@ -987,7 +987,7 @@ docstring InsetBibtex::xhtml(XHTMLStream & xs, OutputParams const &) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetBibtex::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetBibtex::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-bibtex");
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ public:
|
||||
///
|
||||
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
||||
///
|
||||
docstring contextMenu(BufferView const &, int, int) const;
|
||||
docstring contextMenuName() const;
|
||||
//@}
|
||||
|
||||
/// \name Static public methods obligated for InsetCommand derived classes
|
||||
|
@ -529,7 +529,7 @@ void InsetBox::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetBox::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetBox::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-box");
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ private:
|
||||
/// used by the constructors
|
||||
void init();
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
|
||||
///
|
||||
InsetBoxParams params_;
|
||||
|
@ -249,7 +249,7 @@ void InsetBranch::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetBranch::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetBranch::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-branch");
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ private:
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
docstring contextMenu(BufferView const &, int, int) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
void addToToc(DocIterator const &);
|
||||
///
|
||||
|
@ -599,7 +599,7 @@ void InsetCitation::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetCitation::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetCitation::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-citation");
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
///
|
||||
void addToToc(DocIterator const &);
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
//@}
|
||||
|
||||
/// \name Static public methods obligated for InsetCommand derived classes
|
||||
|
@ -622,16 +622,25 @@ docstring InsetCollapsable::contextMenu(BufferView const & bv, int x,
|
||||
int y) const
|
||||
{
|
||||
if (decoration() == InsetLayout::CONGLOMERATE)
|
||||
return from_ascii("context-conglomerate");
|
||||
return contextMenuName();
|
||||
|
||||
if (geometry(bv) == NoButton)
|
||||
return from_ascii("context-collapsable");
|
||||
return contextMenuName();
|
||||
|
||||
Dimension dim = dimensionCollapsed(bv);
|
||||
if (x < xo(bv) + dim.wid && y < yo(bv) + dim.des)
|
||||
return from_ascii("context-collapsable");
|
||||
return contextMenuName();
|
||||
|
||||
return InsetText::contextMenu(bv, x, y);
|
||||
return InsetText::contextMenuName();
|
||||
}
|
||||
|
||||
|
||||
docstring InsetCollapsable::contextMenuName() const
|
||||
{
|
||||
if (decoration() == InsetLayout::CONGLOMERATE)
|
||||
return from_ascii("context-conglomerate");
|
||||
else
|
||||
return from_ascii("context-collapsable");
|
||||
}
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -141,7 +141,9 @@ public:
|
||||
///
|
||||
virtual bool usePlainLayout() const { return true; }
|
||||
///
|
||||
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
///
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
docstring floatName(std::string const & type) const;
|
||||
protected:
|
||||
|
@ -208,7 +208,7 @@ bool InsetCommand::getStatus(Cursor & cur, FuncRequest const & cmd,
|
||||
}
|
||||
|
||||
|
||||
docstring InsetCommand::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetCommand::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-") + from_ascii(insetName(p_.code()));
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ protected:
|
||||
/// \name Methods relaying to the InsetCommandParams p_
|
||||
//@{
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
bool showInsetDialog(BufferView * bv) const;
|
||||
///
|
||||
|
@ -38,7 +38,7 @@ public:
|
||||
///
|
||||
static std::string params2string(CollapseStatus);
|
||||
|
||||
docstring contextMenu(BufferView const &, int, int) const
|
||||
docstring contextMenuName() const
|
||||
{ return from_ascii("context-ert"); }
|
||||
private:
|
||||
///
|
||||
|
@ -789,7 +789,7 @@ void InsetExternal::addPreview(DocIterator const & /*inset_pos*/,
|
||||
}
|
||||
|
||||
|
||||
docstring InsetExternal::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetExternal::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-external");
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ public:
|
||||
/// \returns the number of rows (\n's) of generated code.
|
||||
int latex(odocstream &, OutputParams const &) const;
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
bool setMouseHover(BufferView const * bv, bool mouse_hover);
|
||||
///
|
||||
|
@ -1040,7 +1040,7 @@ void InsetGraphics::addToToc(DocIterator const & cpit)
|
||||
}
|
||||
|
||||
|
||||
docstring InsetGraphics::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetGraphics::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-graphics");
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ private:
|
||||
///
|
||||
void addToToc(DocIterator const &);
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
/// Force inset into LTR environment if surroundings are RTL
|
||||
bool forceLTR() const { return true; }
|
||||
///
|
||||
|
@ -264,7 +264,7 @@ void InsetHyperlink::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetHyperlink::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetHyperlink::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-hyperlink");
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public:
|
||||
///
|
||||
docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||
///
|
||||
docstring contextMenu(BufferView const &, int, int) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
void validate(LaTeXFeatures &) const;
|
||||
///
|
||||
|
@ -898,7 +898,7 @@ void InsetInclude::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetInclude::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetInclude::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-include");
|
||||
}
|
||||
|
@ -103,7 +103,7 @@ public:
|
||||
///
|
||||
void updateBuffer(ParIterator const &, UpdateType);
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
//@}
|
||||
|
||||
/// \name Static public methods obligated for InsetCommand derived classes
|
||||
|
@ -376,7 +376,7 @@ void InsetIndex::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetIndex::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetIndex::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-index");
|
||||
}
|
||||
@ -576,7 +576,7 @@ void InsetPrintIndex::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetPrintIndex::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetPrintIndex::contextMenuName() const
|
||||
{
|
||||
return buffer().masterBuffer()->params().use_indices ?
|
||||
from_ascii("context-indexprint") : docstring();
|
||||
|
@ -79,7 +79,7 @@ private:
|
||||
/// Updates needed features for this inset.
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
Inset * clone() const { return new InsetIndex(*this); }
|
||||
|
||||
@ -108,7 +108,7 @@ public:
|
||||
///
|
||||
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
/// Updates needed features for this inset.
|
||||
void validate(LaTeXFeatures & features) const;
|
||||
///
|
||||
|
@ -452,7 +452,7 @@ void InsetInfo::updateInfo()
|
||||
}
|
||||
|
||||
|
||||
docstring InsetInfo::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetInfo::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-info");
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ public:
|
||||
///
|
||||
docstring toolTip(BufferView const & bv, int x, int y) const;
|
||||
///
|
||||
docstring contextMenu(BufferView const &, int, int) const;
|
||||
docstring contextMenuName() const;
|
||||
/// should paragraph indendation be ommitted in any case?
|
||||
bool neverIndent() const { return true; }
|
||||
|
||||
|
@ -309,7 +309,7 @@ docstring InsetListings::xhtml(XHTMLStream & os, OutputParams const & rp) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetListings::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetListings::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-listings");
|
||||
}
|
||||
|
@ -67,7 +67,7 @@ private:
|
||||
///
|
||||
InsetListingsParams & params() { return params_; }
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
///
|
||||
|
@ -261,7 +261,7 @@ void InsetNewline::draw(PainterInfo & pi, int x, int y) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetNewline::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetNewline::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-newline");
|
||||
}
|
||||
|
@ -77,7 +77,7 @@ private:
|
||||
///
|
||||
ColorCode ColorName() const;
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
Inset * clone() const { return new InsetNewline(*this); }
|
||||
///
|
||||
|
@ -257,7 +257,7 @@ docstring InsetNewpage::xhtml(XHTMLStream & xs, OutputParams const &) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetNewpage::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetNewpage::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-newpage");
|
||||
}
|
||||
|
@ -81,7 +81,7 @@ private:
|
||||
///
|
||||
ColorCode ColorName() const;
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
Inset * clone() const { return new InsetNewpage(*this); }
|
||||
///
|
||||
|
@ -333,7 +333,7 @@ InsetCode InsetPrintNomencl::lyxCode() const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetPrintNomencl::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetPrintNomencl::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-nomenclprint");
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ public:
|
||||
///
|
||||
int latex(odocstream &, OutputParams const &) const;
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
//@}
|
||||
|
||||
/// \name Static public methods obligated for InsetCommand derived classes
|
||||
|
@ -350,7 +350,7 @@ void InsetNote::validate(LaTeXFeatures & features) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetNote::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetNote::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-note");
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ private:
|
||||
/// used by the constructors
|
||||
void init();
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
friend class InsetNoteParams;
|
||||
|
||||
|
@ -358,7 +358,7 @@ docstring InsetPhantom::xhtml(XHTMLStream &, OutputParams const &) const
|
||||
return docstring();
|
||||
}
|
||||
|
||||
docstring InsetPhantom::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetPhantom::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-phantom");
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ private:
|
||||
/// used by the constructors
|
||||
void init();
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
friend class InsetPhantomParams;
|
||||
|
||||
|
@ -49,7 +49,7 @@ public:
|
||||
|
||||
bool descendable(BufferView const & /*bv*/) const { return true; }
|
||||
|
||||
docstring contextMenu(BufferView const &, int, int) const
|
||||
docstring contextMenuName() const
|
||||
{ return from_ascii("context-preview"); }
|
||||
|
||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
||||
|
@ -423,7 +423,7 @@ docstring InsetScript::xhtml(XHTMLStream & xs, OutputParams const & runparams) c
|
||||
}
|
||||
|
||||
|
||||
docstring InsetScript::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetScript::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-script");
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ public:
|
||||
///
|
||||
Inset * clone() const { return new InsetScript(*this); }
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
//@}
|
||||
|
||||
/// \name Public functions inherited from InsetText class
|
||||
|
@ -753,7 +753,7 @@ bool InsetSpace::isStretchableSpace() const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetSpace::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetSpace::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-space");
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
// a line separator)?
|
||||
bool isSpace() const { return true; }
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
bool clickable(int /* x */, int /* y */) const { return true; }
|
||||
protected:
|
||||
|
@ -3327,7 +3327,7 @@ void InsetTabular::write(ostream & os) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetTabular::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetTabular::contextMenuName() const
|
||||
{
|
||||
// FIXME: depending on the selection state, we could offer a different menu.
|
||||
return from_ascii("context-tabular");
|
||||
|
@ -813,7 +813,7 @@ public:
|
||||
///
|
||||
InsetCode lyxCode() const { return TABULAR_CODE; }
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
/// get offset of this cursor slice relative to our upper left corner
|
||||
void cursorPos(BufferView const & bv, CursorSlice const & sl,
|
||||
bool boundary, int & x, int & y) const;
|
||||
|
@ -813,7 +813,7 @@ void InsetText::completionPosAndDim(Cursor const & cur, int & x, int & y,
|
||||
}
|
||||
|
||||
|
||||
docstring InsetText::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetText::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-edit");
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ public:
|
||||
docstring toolTipText(docstring prefix = empty_docstring()) const;
|
||||
|
||||
///
|
||||
virtual docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
protected:
|
||||
|
@ -233,7 +233,7 @@ docstring InsetVSpace::xhtml(XHTMLStream &, OutputParams const &) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetVSpace::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetVSpace::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-vspace");
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public:
|
||||
///
|
||||
bool hasSettings() const { return true; }
|
||||
///
|
||||
docstring contextMenu(BufferView const & bv, int x, int y) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
static void string2params(std::string const &, VSpace &);
|
||||
///
|
||||
|
@ -1968,7 +1968,7 @@ void InsetMathHull::tocString(odocstream & os) const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetMathHull::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetMathHull::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-math");
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public:
|
||||
void recordLocation(DocIterator const & di);
|
||||
|
||||
///
|
||||
virtual docstring contextMenu(BufferView const &, int, int) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
InsetCode lyxCode() const { return MATH_HULL_CODE; }
|
||||
|
||||
|
@ -268,7 +268,7 @@ InsetSpaceParams InsetMathSpace::params() const
|
||||
}
|
||||
|
||||
|
||||
docstring InsetMathSpace::contextMenu(BufferView const &, int, int) const
|
||||
docstring InsetMathSpace::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-mathspace");
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ public:
|
||||
///
|
||||
bool hasSettings() const { return true; }
|
||||
///
|
||||
docstring contextMenu(BufferView const &, int, int) const;
|
||||
docstring contextMenuName() const;
|
||||
///
|
||||
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
|
||||
///
|
||||
|
@ -1353,7 +1353,7 @@ void MathMacroTemplate::infoize(odocstream & os) const
|
||||
}
|
||||
|
||||
|
||||
docstring MathMacroTemplate::contextMenu(BufferView const &, int, int) const
|
||||
docstring MathMacroTemplate::contextMenuName() const
|
||||
{
|
||||
return from_ascii("context-math-macro-definition");
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
///
|
||||
void infoize(odocstream & os) const;
|
||||
///
|
||||
docstring contextMenu(BufferView const &, int, int) const;
|
||||
docstring contextMenuName() const;
|
||||
protected:
|
||||
///
|
||||
virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
|
||||
|
Loading…
Reference in New Issue
Block a user