10 #include "FuncStatus.h"
11 #include "kbsequence.h"
12 #include "commandtags.h"
15 #include <boost/signals/trackable.hpp>
22 /** This class encapsulates all the LyX command operations.
23 This is the class of the LyX's "high level event handler".
24 Every user command is processed here, either invocated from
25 keyboard or from the GUI. All GUI objects, including buttons and
26 menus should use this class and never call kernel functions directly.
28 class LyXFunc : public boost::signals::trackable {
34 /// LyX dispatcher, executes lyx actions.
35 void dispatch(FuncRequest const &, bool verbose = false);
37 /// Dispatch via a string argument
38 void dispatch(string const & s, bool verbose = false);
40 /// Dispatch via a pseudo action, also displaying shortcut/command name
41 void dispatch(int ac, bool verbose = false);
43 /// return the status bar state string
44 string const view_status_message();
47 void processKeySym(LyXKeySymPtr key, key_modifier::state state);
49 /// we need one internal which is called from inside LyXAction and
50 /// can contain the string argument.
51 FuncStatus getStatus(int ac) const;
53 FuncStatus getStatus(FuncRequest const & action) const;
55 /// The last key was meta
56 bool wasMetaKey() const;
58 /// True if lyxfunc reports an error
59 bool errorStat() const { return errorstat; }
60 /// Buffer to store result messages
61 void setMessage(string const & m) const;
62 /// Buffer to store result messages
63 void setErrorMessage(string const &) const;
64 /// Buffer to store result messages from getStatus
65 void setStatusMessage(string const &) const;
66 /// Buffer to store result messages
67 string const getMessage() const { return dispatch_buffer; }
68 /// Buffer to store result messages
69 string const getStatusMessage() const { return status_buffer; }
70 /// Handle a accented char key sequence
71 void handleKeyFunc(kb_action action);
81 kb_sequence cancel_meta_seq;
83 key_modifier::state meta_fake_bit;
85 void moveCursorUpdate(bool flag = true, bool selecting = false);
87 void setupLocalKeymap();
89 kb_action lyx_dead_action;
91 kb_action lyx_calling_dead_action;
92 /// Error status, only Dispatch can change this flag
93 mutable bool errorstat;
95 /** Buffer to store messages and result data. Is there a
96 good reason to have this one as static in Dispatch? (Ale)
98 mutable string dispatch_buffer;
99 /** Buffer to store messages and result data from getStatus
101 mutable string status_buffer;
103 /// send a post-dispatch status message
104 void sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose);
106 // I think the following should be moved to BufferView. (Asger)
109 void menuNew(string const & argument, bool fromTemplate);
112 void open(string const &);
115 void doImport(string const &);
122 // This return or directly text (default) of getLyXText()
124 LyXText * TEXT(bool) const;
129 /*-------------------- inlines --------------------------*/
132 bool LyXFunc::wasMetaKey() const
134 return (meta_fake_bit != key_modifier::none);