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) const;
71 /// Buffer to store result messages
72 void setErrorMessage(string const &) const;
73 /// Buffer to store result messages from getStatus
74 void setStatusMessage(string const &) const;
75 /// Buffer to store result messages
76 string const getMessage() const { return dispatch_buffer; }
77 /// Buffer to store result messages
78 string const getStatusMessage() const { return status_buffer; }
79 /// Handle a accented char keysequenze
80 void handleKeyFunc(kb_action action);
90 kb_sequence cancel_meta_seq;
92 unsigned meta_fake_bit;
94 void moveCursorUpdate(bool flag = true, bool selecting = false);
96 void setupLocalKeymap();
98 kb_action lyx_dead_action;
100 kb_action lyx_calling_dead_action;
101 /// Error status, only Dispatch can change this flag
102 mutable bool errorstat;
104 /** Buffer to store messages and result data. Is there a
105 good reason to have this one as static in Dispatch? (Ale)
107 mutable string dispatch_buffer;
108 /** Buffer to store messages and result data from getStatus
110 mutable string status_buffer;
111 /// Command name and shortcut information
112 string commandshortcut;
114 // I think the following should be moved to BufferView. (Asger)
117 void menuNew(bool fromTemplate);
120 void open(string const &);
123 void doImport(string const &);
130 // This return or directly text (default) of getLyXText()
132 LyXText * TEXT(bool) const;
137 /*-------------------- inlines --------------------------*/
140 bool LyXFunc::wasMetaKey() const
142 return (meta_fake_bit != 0);