- docstring before_str;
- if (!before.empty()) {
- // In CITET and CITEALT mode, the "before" string is
- // attached to the label associated with each and every key.
- // In CITEP, CITEALP and CITEYEARPAR mode, it is attached
- // to the front of the whole only.
- // In other modes, it is not used at all.
- if (cite_type == "citet" ||
- cite_type == "citealt" ||
- cite_type == "citep" ||
- cite_type == "citealp" ||
- cite_type == "citeyearpar")
- before_str = before + ' ';
- // In CITE (jurabib), the "before" string is used to attach
- // the annotator (of legal texts) to the author(s) of the
- // first reference.
- else if (cite_type == "cite")
- before_str = '/' + before;
+bool InsetCitation::getStatus(Cursor & cur, FuncRequest const & cmd,
+ FuncStatus & status) const
+{
+ switch (cmd.action()) {
+ // Handle the alias case
+ case LFUN_INSET_MODIFY:
+ if (cmd.getArg(0) == "changetype") {
+ string cmdname = getCmdName();
+ string const alias =
+ buffer().masterParams().getCiteAlias(cmdname);
+ if (!alias.empty())
+ cmdname = alias;
+ if (suffixIs(cmdname, "*"))
+ cmdname = rtrim(cmdname, "*");
+ string const newtype = cmd.getArg(1);
+ status.setEnabled(isCompatibleCommand(newtype));
+ status.setOnOff(newtype == cmdname);
+ }
+ if (cmd.getArg(0) == "toggleparam") {
+ string cmdname = getCmdName();
+ string const alias =
+ buffer().masterParams().getCiteAlias(cmdname);
+ if (!alias.empty())
+ cmdname = alias;
+ vector<CitationStyle> citation_styles =
+ buffer().masterParams().citeStyles();
+ CitationStyle cs = getCitationStyle(buffer().masterParams(),
+ cmdname, citation_styles);
+ if (cmd.getArg(1) == "star") {
+ status.setEnabled(cs.hasStarredVersion);
+ status.setOnOff(suffixIs(cmdname, "*"));
+ }
+ else if (cmd.getArg(1) == "casing") {
+ status.setEnabled(cs.forceUpperCase);
+ status.setOnOff(isUpperCase(cmdname[0]));
+ }
+ }
+ return true;
+ default:
+ return InsetCommand::getStatus(cur, cmd, status);