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