10 #include <sigc++/signal_system.h>
12 #include "commandtags.h" // for kb_action enum
13 #include "FuncStatus.h"
14 #include "kbsequence.h"
21 /** This class encapsulates all the LyX command operations.
22 This is the class of the LyX's "high level event handler".
23 Every user command is processed here, either invocated from
24 keyboard or from the GUI. All GUI objects, including buttons and
25 menus should use this class and never call kernel functions directly.
27 class LyXFunc : public SigC::Object {
33 /// LyX dispatcher, executes lyx actions.
34 string const dispatch(kb_action ac, string argument = string());
36 /// The same as dispatch, but also shows shortcuts and command
37 /// name in minibuffer if show_sc is true (more to come?)
38 void const LyXFunc::verboseDispatch(kb_action action,
39 string const & argument,
42 /// Same as above, using a pseudoaction as argument
43 void const LyXFunc::verboseDispatch(int ac, bool show_sc);
45 /// Same as above, when the command is provided as a string
46 void const LyXFunc::verboseDispatch(string const & s, bool show_sc);
49 void LyXFunc::miniDispatch(string const & s);
52 void initMiniBuffer();
55 void processKeySym(KeySym k, unsigned int state);
57 /// we need one internal which is called from inside LyXAction and
58 /// can contain the string argument.
59 FuncStatus getStatus(int ac) const;
61 FuncStatus getStatus(kb_action action,
62 string const & argument = string()) const;
64 /// The last key was meta
65 bool wasMetaKey() const;
67 /// True if lyxfunc reports an error
68 bool errorStat() const { return errorstat; }
69 /// Buffer to store result messages
70 void setMessage(string const & m);
71 /// Buffer to store result messages
72 void setErrorMessage(string const &) const;
73 /// Buffer to store result messages
74 string const getMessage() const { return dispatch_buffer; }
75 /// Handle a accented char keysequenze
76 void handleKeyFunc(kb_action action);
86 kb_sequence cancel_meta_seq;
88 unsigned meta_fake_bit;
90 void moveCursorUpdate(bool flag = true, bool selecting = false);
92 void setupLocalKeymap();
94 kb_action lyx_dead_action;
96 kb_action lyx_calling_dead_action;
97 /// Error status, only Dispatch can change this flag
98 mutable bool errorstat;
100 /** Buffer to store messages and result data. Is there a
101 good reason to have this one as static in Dispatch? (Ale)
103 mutable string dispatch_buffer;
104 /// Command name and shortcut information
105 string commandshortcut;
107 // I think the following should be moved to BufferView. (Asger)
110 void menuNew(bool fromTemplate);
113 void open(string const &);
116 void doImport(string const &);
123 // This return or directly text (default) of getLyXText()
125 LyXText * TEXT(bool) const;
130 /*-------------------- inlines --------------------------*/
133 bool LyXFunc::wasMetaKey() const
135 return (meta_fake_bit != 0);