10 #include "commandtags.h" // for kb_action enum
11 #include "FuncStatus.h"
12 #include "kbsequence.h"
15 #include "frontends/mouse_state.h"
16 #include "frontends/key_state.h"
18 #include <boost/signals/trackable.hpp>
26 /** This class encapsulates all the LyX command operations.
27 This is the class of the LyX's "high level event handler".
28 Every user command is processed here, either invocated from
29 keyboard or from the GUI. All GUI objects, including buttons and
30 menus should use this class and never call kernel functions directly.
32 class LyXFunc : public boost::signals::trackable {
38 /// LyX dispatcher, executes lyx actions.
39 string const dispatch(kb_action ac, string argument = string());
41 /// The same as dispatch, but also shows shortcuts and command
42 /// name in minibuffer if show_sc is true (more to come?)
43 void verboseDispatch(kb_action action,
44 string const & argument,
47 /// Same as above, using a pseudoaction as argument
48 void verboseDispatch(int ac, bool show_sc);
50 /// Same as above, when the command is provided as a string
51 void verboseDispatch(string const & s, bool show_sc);
54 void miniDispatch(string const & s);
57 void initMiniBuffer();
60 void processKeySym(KeySym key, key_modifier::state state);
62 /// we need one internal which is called from inside LyXAction and
63 /// can contain the string argument.
64 FuncStatus getStatus(int ac) const;
66 FuncStatus getStatus(kb_action action,
67 string const & argument = string()) const;
69 /// The last key was meta
70 bool wasMetaKey() const;
72 /// True if lyxfunc reports an error
73 bool errorStat() const { return errorstat; }
74 /// Buffer to store result messages
75 void setMessage(string const & m) const;
76 /// Buffer to store result messages
77 void setErrorMessage(string const &) const;
78 /// Buffer to store result messages from getStatus
79 void setStatusMessage(string const &) const;
80 /// Buffer to store result messages
81 string const getMessage() const { return dispatch_buffer; }
82 /// Buffer to store result messages
83 string const getStatusMessage() const { return status_buffer; }
84 /// Handle a accented char keysequenze
85 void handleKeyFunc(kb_action action);
95 kb_sequence cancel_meta_seq;
97 key_modifier::state meta_fake_bit;
99 void moveCursorUpdate(bool flag = true, bool selecting = false);
101 void setupLocalKeymap();
103 kb_action lyx_dead_action;
105 kb_action lyx_calling_dead_action;
106 /// Error status, only Dispatch can change this flag
107 mutable bool errorstat;
109 /** Buffer to store messages and result data. Is there a
110 good reason to have this one as static in Dispatch? (Ale)
112 mutable string dispatch_buffer;
113 /** Buffer to store messages and result data from getStatus
115 mutable string status_buffer;
116 /// Command name and shortcut information
117 string commandshortcut;
119 // I think the following should be moved to BufferView. (Asger)
122 void menuNew(bool fromTemplate);
125 void open(string const &);
128 void doImport(string const &);
135 // This return or directly text (default) of getLyXText()
137 LyXText * TEXT(bool) const;
142 /*-------------------- inlines --------------------------*/
145 bool LyXFunc::wasMetaKey() const
147 return (meta_fake_bit != key_modifier::none);