#include "BufferList.h"
#include "BufferParams.h"
#include "BufferView.h"
+#include "CmdDef.h"
#include "Color.h"
#include "Cursor.h"
#include "CutAndPaste.h"
LYXERR(Debug::KEY) << BOOST_CURRENT_FUNCTION
<< " Key [action="
<< func.action << "]["
- << to_utf8(keyseq.print(false)) << ']'
+ << to_utf8(keyseq.print(KeySequence::Portable)) << ']'
<< endl;
// already here we know if it any point in going further
// num_bytes == 0? (Lgb)
if (keyseq.length() > 1)
- lyx_view_->message(keyseq.print(true));
+ lyx_view_->message(keyseq.print(KeySequence::ForGui));
// Maybe user can only reach the key via holding down shift.
FuncRequest func(lyxaction.lookupFunc(firstcmd));
func.origin = cmd.origin;
flag = getStatus(func);
+ break;
+ }
+
+ case LFUN_CALL: {
+ FuncRequest func;
+ std::string name(to_utf8(cmd.argument()));
+ if (LyX::ref().topLevelCmdDef().lock(name, func)) {
+ func.origin = cmd.origin;
+ flag = getStatus(func);
+ LyX::ref().topLevelCmdDef().release(name);
+ } else {
+ // catch recursion or unknown command definiton
+ // all operations until the recursion or unknown command
+ // definiton occures are performed, so set the state to enabled
+ enable = true;
+ }
+ break;
}
case LFUN_BUFFER_NEW:
case LFUN_META_PREFIX:
meta_fake_bit = AltModifier;
- setMessage(keyseq.print(true));
+ setMessage(keyseq.print(KeySequence::ForGui));
break;
case LFUN_BUFFER_TOGGLE_READ_ONLY: {
break;
case LFUN_SERVER_NOTIFY:
- dispatch_buffer = keyseq.print(false);
+ dispatch_buffer = keyseq.print(KeySequence::Portable);
theServer().notifyClient(to_utf8(dispatch_buffer));
break;
break;
}
+ case LFUN_CALL: {
+ FuncRequest func;
+ if (LyX::ref().topLevelCmdDef().lock(argument, func)) {
+ func.origin = cmd.origin;
+ dispatch(func);
+ LyX::ref().topLevelCmdDef().release(argument);
+ } else {
+ if (func.action == LFUN_UNKNOWN_ACTION) {
+ // unknown command definition
+ lyxerr << "Warning: unknown command definition `"
+ << argument << "'"
+ << endl;
+ } else {
+ // recursion detected
+ lyxerr << "Warning: Recursion in the command definition `"
+ << argument << "' detected"
+ << endl;
+ }
+ }
+ break;
+ }
+
case LFUN_PREFERENCES_SAVE: {
lyxrc.write(makeAbsPath("preferences",
package().user_support().absFilename()),
{
// When meta-fake key is pressed, show the key sequence so far + "M-".
if (wasMetaKey())
- return keyseq.print(true) + "M-";
+ return keyseq.print(KeySequence::ForGui) + "M-";
// Else, when a non-complete key sequence is pressed,
// show the available options.