10 #include <sigc++/signal_system.h>
12 #include "frontends/mouse_state.h"
13 #include "frontends/key_state.h"
14 #include "commandtags.h" // for kb_action enum
15 #include "FuncStatus.h"
16 #include "kbsequence.h"
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 SigC::Object {
35 /// LyX dispatcher, executes lyx actions.
36 string const dispatch(kb_action ac, string argument = string());
38 /// The same as dispatch, but also shows shortcuts and command
39 /// name in minibuffer if show_sc is true (more to come?)
40 void verboseDispatch(kb_action action,
41 string const & argument,
44 /// Same as above, using a pseudoaction as argument
45 void verboseDispatch(int ac, bool show_sc);
47 /// Same as above, when the command is provided as a string
48 void verboseDispatch(string const & s, bool show_sc);
51 void miniDispatch(string const & s);
54 void initMiniBuffer();
57 void processKeySym(KeySym key, key_modifier::state state);
59 /// we need one internal which is called from inside LyXAction and
60 /// can contain the string argument.
61 FuncStatus getStatus(int ac) const;
63 FuncStatus getStatus(kb_action action,
64 string const & argument = string()) const;
66 /// The last key was meta
67 bool wasMetaKey() const;
69 /// True if lyxfunc reports an error
70 bool errorStat() const { return errorstat; }
71 /// Buffer to store result messages
72 void setMessage(string const & m) const;
73 /// Buffer to store result messages
74 void setErrorMessage(string const &) const;
75 /// Buffer to store result messages from getStatus
76 void setStatusMessage(string const &) const;
77 /// Buffer to store result messages
78 string const getMessage() const { return dispatch_buffer; }
79 /// Buffer to store result messages
80 string const getStatusMessage() const { return status_buffer; }
81 /// Handle a accented char keysequenze
82 void handleKeyFunc(kb_action action);
92 kb_sequence cancel_meta_seq;
94 key_modifier::state meta_fake_bit;
96 void moveCursorUpdate(bool flag = true, bool selecting = false);
98 void setupLocalKeymap();
100 kb_action lyx_dead_action;
102 kb_action lyx_calling_dead_action;
103 /// Error status, only Dispatch can change this flag
104 mutable bool errorstat;
106 /** Buffer to store messages and result data. Is there a
107 good reason to have this one as static in Dispatch? (Ale)
109 mutable string dispatch_buffer;
110 /** Buffer to store messages and result data from getStatus
112 mutable string status_buffer;
113 /// Command name and shortcut information
114 string commandshortcut;
116 // I think the following should be moved to BufferView. (Asger)
119 void menuNew(bool fromTemplate);
122 void open(string const &);
125 void doImport(string const &);
132 // This return or directly text (default) of getLyXText()
134 LyXText * TEXT(bool) const;
139 /*-------------------- inlines --------------------------*/
142 bool LyXFunc::wasMetaKey() const
144 return (meta_fake_bit != key_modifier::none);