10 #include <sigc++/signal_system.h>
12 #include "commandtags.h" // for kb_action enum
13 #include "func_status.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(int action, string const & arg = string());
36 /// The same but uses the name of a lyx command.
37 string const dispatch(string const & cmd);
40 void miniDispatch(string const & cmd);
43 void initMiniBuffer();
46 void processKeySym(KeySym k, unsigned int state);
48 /// we need one internall which is called from inside LyXAction and
49 /// can contain the string argument.
50 func_status::value_type getStatus(int ac) const;
52 func_status::value_type getStatus(int ac,
53 string const & not_to_use_arg) 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);
62 /// Buffer to store result messages
63 void setErrorMessage(string const &) const;
64 /// Buffer to store result messages
65 string const getMessage() const { return dispatch_buffer; }
66 /// Handle a accented char keysequenze
67 void handleKeyFunc(kb_action action);
68 /// Should a hint message be displayed?
69 void setHintMessage(bool);
78 kb_sequence cancel_meta_seq;
80 unsigned meta_fake_bit;
82 void moveCursorUpdate(bool flag = true, bool selecting = false);
84 void setupLocalKeymap();
86 kb_action lyx_dead_action;
88 kb_action lyx_calling_dead_action;
89 /// Error status, only Dispatch can change this flag
90 mutable bool errorstat;
92 /** Buffer to store messages and result data. Is there a
93 good reason to have this one as static in Dispatch? (Ale)
95 mutable string dispatch_buffer;
96 /// Command name and shortcut information
97 string commandshortcut;
99 // I think the following should be moved to BufferView. (Asger)
102 void menuNew(bool fromTemplate);
105 void open(string const &);
108 void doImport(string const &);
115 // This return or directly text (default) of getLyXText()
117 LyXText * TEXT(bool) const;
119 // This is the same for all lyxfunc objects
124 /*-------------------- inlines --------------------------*/
127 bool LyXFunc::wasMetaKey() const
129 return (meta_fake_bit != 0);
134 void LyXFunc::setHintMessage(bool hm)