Implement basic context menu for include insets.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24525 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2008-04-27 15:49:15 +00:00
parent fa568e12f0
commit 878b3ce315
3 changed files with 24 additions and 3 deletions

View File

@ -181,8 +181,17 @@ Menuset
Item "Settings...|S" "next-inset-toggle"
End
Menu "edit_vspacetype"
#
# InsetInclude context menu
#
Menu "context-include"
Item "Include|c" "next-inset-modify changetype include"
Item "Input|p" "next-inset-modify changetype input"
Item "Verbatim|V" "next-inset-modify changetype verbatiminput"
Item "Verbatim (marked blanks)|b" "next-inset-modify changetype verbatiminput*"
Item "Listing|L" "next-inset-modify changetype lstinputlisting"
Separator
Item "Settings...|S" "next-inset-toggle"
End
#

View File

@ -243,7 +243,11 @@ void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd)
case LFUN_INSET_MODIFY: {
InsetCommandParams p(INCLUDE_CODE);
InsetCommand::string2params("include", to_utf8(cmd.argument()), p);
if (cmd.getArg(0) == "changetype") {
InsetCommand::doDispatch(cur, cmd);
p = params();
} else
InsetCommand::string2params("include", to_utf8(cmd.argument()), p);
if (!p.getCmdName().empty()) {
if (isListings(p)){
InsetListingsParams new_params(to_utf8(p["lstparams"]));
@ -761,6 +765,12 @@ void InsetInclude::draw(PainterInfo & pi, int x, int y) const
}
docstring InsetInclude::contextMenu(BufferView const &, int, int) const
{
return from_ascii("context-include");
}
Inset::DisplayType InsetInclude::display() const
{
return type(params()) == INPUT ? Inline : AlignCenter;

View File

@ -93,6 +93,8 @@ public:
static std::string defaultCommand() { return "include"; }
///
static bool isCompatibleCommand(std::string const & s);
///
docstring contextMenu(BufferView const & bv, int x, int y) const;
protected:
InsetInclude(InsetInclude const &);
///