I have hit a small nastiness when trying to replace the LFUNs below with a 
single LFUN_DIALOG_SHOW <name>. They all have different "attrib"s, Noop, 
NoBuffer, etc.

Replace these
        { LFUN_DIALOG_PREFERENCES, "dialog-preferences", NoBuffer },
        { LFUN_FORKS_SHOW, "show-forks", NoBuffer },
        { LFUN_HELP_ABOUTLYX, "help-aboutlyx", NoBuffer },
        { LFUN_HELP_TEXINFO, "help-Texinfo", NoBuffer },
        { LFUN_LATEX_LOG, "latex-view-log", ReadOnly },
        { LFUN_LAYOUT_CHARACTER, "layout-character", ReadOnly },
        { LFUN_LAYOUT_DOCUMENT, "layout-document", ReadOnly },
        { LFUN_LAYOUT_PREAMBLE, "layout-preamble", ReadOnly },
        { LFUN_MATH_PANEL, "math-panel", Noop },
        { LFUN_MENUPRINT, "buffer-print", ReadOnly },
        { LFUN_MENUSEARCH, "find-replace", ReadOnly },
        { LFUN_SPELLCHECK, "spellchecker", Noop },
        { LFUN_VC_HISTORY, "vc-history", ReadOnly },
with this
        { LFUN_DIALOG_SHOW, "dialog-show", Argument },

This information is overridden by the single Argument attrib, but I wonder 
if we should devise some extra machinery to preserve the lost info? Eg, add 
something like this to LyXAction::init:

        std::map<string, unsigned int> takesarg_attribs;
        takesarg_attribs["dialog-show preferences"] = NoBuffer;
        takesarg_attribs["dialog-show forks"] = NoBuffer;
        takesarg_attribs["dialog-show aboutlyx"] = NoBuffer;
        takesarg_attribs["dialog-show texinfo"] = NoBuffer;
        takesarg_attribs["dialog-show latexlog"] = ReadOnly;
        takesarg_attribs["dialog-show character"] = ReadOnly;
        takesarg_attribs["dialog-show document"] = ReadOnly;
        takesarg_attribs["dialog-show preamble"] = ReadOnly;
        takesarg_attribs["dialog-show mathpanel"] = Noop;
        takesarg_attribs["dialog-show print"] = ReadOnly;
        takesarg_attribs["dialog-show findreplace"] = ReadOnly;
        takesarg_attribs["dialog-show spellchecker"] = Noop;
        takesarg_attribs["dialog-show vc-history"] = ReadOnly;

and then pass the argument flag to LyXAction::funcHasFlag

bool LyXAction::funcHasFlag(kb_action action,
+                           string const & argument,
                            LyXAction::func_attrib flag) const
{
        info_map::const_iterator ici = lyx_info_map.find(action);

        if (ici != lyx_info_map.end()) {
+               if (ici->second.attrib == Argument) {
+                       string const id = ici->second.name + ' ' + argument;
+                       unsigned int attrib = takesarg_attribs[id];
+                       return attrib & flag;
+               } else
+                       return ici->second.attrib & flag;
-               return ici->second.attrib & flag;
        } else {
                // it really should exist, but...
                lyxerr << "LyXAction::funcHasFlag: "
                        "No info about kb_action: " << action << '\n';
                return false;
        }
}

-- 
Angus


Reply via email to