X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FLyXAction.C;h=acb0edea9771d643227fa15b441e5c2a0439d02e;hb=d9c0aa81954969f65c72b0b229d08a3548d4e5b1;hp=55247ae1c061bfb784e4f0e3af1c762212be734f;hpb=35584afc1162dec2cf9fff79305e95cb3b75aefb;p=lyx.git diff --git a/src/LyXAction.C b/src/LyXAction.C index 55247ae1c0..acb0edea97 100644 --- a/src/LyXAction.C +++ b/src/LyXAction.C @@ -1,12 +1,12 @@ /* This file is part of - * ====================================================== + * ====================================================== * * LyX, The Document Processor * * Copyright 1995 Matthias Ettrich * Copyright 1995-1999 The LyX Team. * - * ======================================================*/ + * ====================================================== */ #include @@ -112,6 +112,7 @@ kb_func_table const lyx_func_table[] = { { "citation-insert", LFUN_INSERT_CITATION }, { "command-execute", LFUN_EXEC_COMMAND }, { "command-prefix", LFUN_PREFIX }, + { "command-sequence", LFUN_SEQUENCE }, { "copy", LFUN_COPY }, { "cut", LFUN_CUT }, { "delete-backward", LFUN_BACKSPACE }, @@ -153,7 +154,9 @@ kb_func_table const lyx_func_table[] = { { "index-insert", LFUN_INDEX_INSERT }, { "index-insert-last", LFUN_INDEX_INSERT_LAST }, { "index-print", LFUN_INDEX_PRINT }, +#if 0 { "inset-latex-insert", LFUN_INSERT_INSET_LATEX }, +#endif { "keymap-off", LFUN_KMAP_OFF }, { "keymap-primary", LFUN_KMAP_PRIM }, { "keymap-secondary", LFUN_KMAP_SEC }, @@ -282,11 +285,11 @@ kb_func_table const lyx_func_table[] = { field with attributes using these tags: enum FUNC_ATTRIB { - LFAT_NONE=0, // Nothing special - LFAT_ISRO=1, // Is readonly (does not modify a buffer) - LFAT_ISIA=2, // Is interactive (requires a GUI) - LFAT_REQARG=4, // Requires argument - LFAT_ISMO=8, // Only math mode + LFAT_NONE= 0, // Nothing special + LFAT_ISRO= 1, // Is readonly (does not modify a buffer) + LFAT_ISIA= 2, // Is interactive (requires a GUI) + LFAT_REQARG= 4, // Requires argument + LFAT_ISMO= 8, // Only math mode LFAT_ETCETC }; @@ -350,7 +353,9 @@ kb_action func_attrib_table[] = { LFUN_INSERTFOOTNOTE, LFUN_INSERT_BIBTEX, LFUN_INSERT_CITATION, +#if 0 LFUN_INSERT_INSET_LATEX, +#endif LFUN_INSERT_LABEL, LFUN_INSERT_MATH, LFUN_INSERT_MATRIX, @@ -436,7 +441,7 @@ LyXAction::~LyXAction() // This is wrong, so I'll just disable it for now. // The problem is that we might free memory twice in some situations... // It's better to leak a bit that to crash. (Asger) -// for (int i=0; i < psd_idx; i++) { +// for (int i= 0; i < psd_idx; i++) { // free(lyx_func_args[i].name); // } delete[] lyx_func_args; @@ -449,8 +454,8 @@ LyXAction::~LyXAction() int LyXAction::searchActionArg(kb_action action, char const *arg) { kb_func_table *tb = &lyx_func_args[0]; - for (int i=0; iaction && !strcmp(tb->name, arg)) { + for (int i= 0; iaction && !strcmp(tb->name, arg)) { lyxerr[Debug::KEY] << "Pseudoaction already exist[" << action << '|' @@ -472,7 +477,7 @@ int LyXAction::getPseudoAction(kb_action action, char const *arg) if (psdaction >= 0) return psdaction; - if (psd_idx>=MAX_PSEUDO_ACTION) { + if (psd_idx>= MAX_PSEUDO_ACTION) { lyxerr << "Lyx Error: No more pseudo-actions allowed" << " Tell the developers." << endl; return -1; @@ -499,7 +504,7 @@ int LyXAction::retrieveActionArg(int i, char const** arg) // Returns an action tag from a string. -int LyXAction::LookupFunc(char const *func) +int LyXAction::LookupFunc(char const * func) { if (!func) return LFUN_UNKNOWN_ACTION; @@ -510,14 +515,16 @@ int LyXAction::LookupFunc(char const *func) valid func table slot. RVDK_PATCH_5 */ int k, l= 0, r = funcCount; int action = LFUN_UNKNOWN_ACTION; - char *arg = strchr(func, ' '); + char * arg = strchr(const_cast(func), ' '); // const cast to + // help a sun complier, will go away when this func is rewritten + // to use std::containers and std::string. if (arg) *(arg++) = '\0'; while (l < r) { last_action_idx = (l+r)/2; k = strcmp(lyx_func_table[last_action_idx].name, func); - if (k==0) { + if (k == 0) { action = lyx_func_table[last_action_idx].action; break; } else @@ -564,14 +571,14 @@ char const *LyXAction::getActionName(int action) const // why LFUN_LASTACTION -1? Because LFUN_LASTACTION is too // large an because there is one internal command, hence // lyx_func_table is 2 less then LFUN_LASTACTION (Lgb) - for (int i=0; i < funcCount; i++) { - if (lyx_func_table[i].action==action) + for (int i= 0; i < funcCount; i++) { + if (lyx_func_table[i].action == action) return lyx_func_table[i].name; } // Hmm.. let's see whether this is a pseudoaction action -= LFUN_LASTACTION; - if (action>=0 && action= 0 && action=funcCount) + if (action <= 1 || action >= funcCount) goto no_desc; if (helpTexts[action].action == action) { @@ -717,9 +724,9 @@ char const *LyXAction::helpText(kb_action action) const // Function to compare items from the attrib table. -int actioncomp(const void *a, const void *b) +extern "C" int actioncomp(const void *a, const void *b) { - int const *ia=(int const*)a, *ib=(int const*)b; + int const *ia= (int const*)a, *ib= (int const*)b; return (*ia)-(*ib); } @@ -732,7 +739,7 @@ bool LyXAction::isFuncRO(kb_action action) const if (!is_sorted) { qsort(func_attrib_table, fCount, sizeof(kb_action), actioncomp); is_sorted = true; -// for (int i=0; i