diff --git a/lib/ui/stdcontext.inc b/lib/ui/stdcontext.inc index d073006eb7..f440d98c43 100644 --- a/lib/ui/stdcontext.inc +++ b/lib/ui/stdcontext.inc @@ -630,6 +630,16 @@ Menuset Menu "context-index" IndicesContext + Separator + OptItem "Single Page (No Page Range)|P" "inset-modify changeparam range none" + OptItem "Start Page Range|t" "inset-modify changeparam range start" + OptItem "End Page Range|E" "inset-modify changeparam range end" + Separator + OptItem "No Page Formatting|N" "inset-modify changeparam pagefmt default" + OptItem "Bold Page Formatting|B" "inset-modify changeparam pagefmt textbf" + OptItem "Italic Page Formatting|I" "inset-modify changeparam pagefmt textit" + OptItem "Emphasized Page Formatting|z" "inset-modify changeparam pagefmt emph" + OptItem "Custom Page Formatting|C" "inset-modify changeparam pagefmt custom" End Menu "context-edit-index" diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp index d863ed2366..b5625e81be 100644 --- a/src/insets/InsetIndex.cpp +++ b/src/insets/InsetIndex.cpp @@ -582,6 +582,21 @@ void InsetIndex::doDispatch(Cursor & cur, FuncRequest & cmd) params_.index = from_utf8(cmd.getArg(1)); break; } + if (cmd.getArg(0) == "changeparam") { + string const p = cmd.getArg(1); + string const v = cmd.getArg(2); + cur.recordUndoInset(this); + if (p == "range") + params_.range = insetindexpagerangetranslator().find(v); + if (p == "pagefmt") { + if (v == "default" || v == "textbf" + || v == "textit" || v == "emph") + params_.pagefmt = v; + else + lyx::dispatch(FuncRequest(LFUN_INSET_SETTINGS, "index")); + } + break; + } InsetIndexParams params; InsetIndex::string2params(to_utf8(cmd.argument()), params); cur.recordUndoInset(this); @@ -629,6 +644,23 @@ bool InsetIndex::getStatus(Cursor & cur, FuncRequest const & cmd, from_utf8(cmd.getArg(1)) == params_.index); return true; } + if (cmd.getArg(0) == "changeparam") { + string const p = cmd.getArg(1); + string const v = cmd.getArg(2); + if (p == "range") { + flag.setEnabled(v == "none" || v == "start" || v == "end"); + flag.setOnOff(params_.range == insetindexpagerangetranslator().find(v)); + } + if (p == "pagefmt") { + flag.setEnabled(!v.empty()); + if (params_.pagefmt == "default" || params_.pagefmt == "textbf" + || params_.pagefmt == "textit" || params_.pagefmt == "emph") + flag.setOnOff(params_.pagefmt == v); + else + flag.setOnOff(v == "custom"); + } + return true; + } return InsetCollapsible::getStatus(cur, cmd, flag); case LFUN_INSET_DIALOG_UPDATE: {