5 #include <sigc++/signal_system.h>
11 #include "commandtags.h"
12 #include "func_status.h"
13 #include "kbsequence.h"
14 #include "insets/inset.h"
20 /** This class encapsulates all the LyX command operations.
21 This is the class of the LyX's "high level event handler".
22 Every user command is processed here, either invocated from
23 keyboard or from the GUI. All GUI objects, including buttons and
24 menus should use this class and never call kernel functions directly.
26 class LyXFunc : public SigC::Object {
32 /// LyX dispatcher, executes lyx actions.
33 string const dispatch(int action, string const & arg = string());
35 /// The same but uses the name of a lyx command.
36 string const dispatch(string const & cmd);
39 void miniDispatch(string const & cmd);
42 void initMiniBuffer();
45 void processKeySym(KeySym k, unsigned int state);
47 /// we need one internall which is called from inside LyXAction and
48 /// can contain the string argument.
49 func_status::value_type getStatus(int ac) const;
51 func_status::value_type getStatus(int ac,
52 string const & not_to_use_arg) const;
54 /// The last key was meta
55 bool wasMetaKey() const;
57 // These can't be global because are part of the
58 // internal state (ale970227)
59 /// Get the current keyseq string
60 string const keyseqStr() const;
62 /// Is the key sequence uncomplete?
63 bool keyseqUncomplete() const;
65 /// get options for the current keyseq
66 string const keyseqOptions() const;
68 /// True if lyxfunc reports an error
69 bool errorStat() const { return errorstat; }
70 /// Buffer to store result messages
71 void setMessage(string const & m);
72 /// Buffer to store result messages
73 void setErrorMessage(string const &) const;
74 /// Buffer to store result messages
75 string const getMessage() const { return dispatch_buffer; }
76 /// Handle a accented char keysequenze
77 void handleKeyFunc(kb_action action);
78 /// Should a hint message be displayed?
79 void setHintMessage(bool);
88 kb_sequence cancel_meta_seq;
90 unsigned meta_fake_bit;
92 void moveCursorUpdate(bool flag = true, bool selecting = false);
94 void setupLocalKeymap();
96 kb_action lyx_dead_action;
98 kb_action lyx_calling_dead_action;
99 /// Error status, only Dispatch can change this flag
100 mutable bool errorstat;
102 /** Buffer to store messages and result data. Is there a
103 good reason to have this one as static in Dispatch? (Ale)
105 mutable string dispatch_buffer;
106 /// Command name and shortcut information
107 string commandshortcut;
109 // I think the following should be moved to BufferView. (Asger)
112 void menuNew(bool fromTemplate);
115 void open(string const &);
118 void doImport(string const &);
125 // This return or directly text (default) of getLyXText()
127 LyXText * TEXT(bool) const;
129 // This is the same for all lyxfunc objects
134 /*-------------------- inlines --------------------------*/
137 bool LyXFunc::wasMetaKey() const
139 return (meta_fake_bit != 0);
144 string const LyXFunc::keyseqStr() const
146 // Why not just remove this function
148 keyseq.print(text, true);
154 string const LyXFunc::keyseqOptions() const
156 // Why not just remove this function
158 keyseq.printOptions(text);
164 bool LyXFunc::keyseqUncomplete() const
166 return (keyseq.length > 0);
171 void LyXFunc::setHintMessage(bool hm)