5 #include <sigc++/signal_system.h>
11 #include FORMS_H_LOCATION
12 #include "commandtags.h"
13 #include "kbsequence.h"
14 #include "insets/lyxinset.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 {
28 /// The status of a function.
34 /// Command cannot be executed
45 /// LyX dispatcher, executes lyx actions.
46 string const Dispatch(int action, string const & arg = string());
48 /// The same but uses the name of a lyx command.
49 string const Dispatch(string const & cmd);
52 void miniDispatch(string const & cmd);
55 void initMiniBuffer();
58 void processKeySym(KeySym k, unsigned int state);
60 /// we need one internall which is called from inside LyXAction and
61 /// can contain the string argument.
62 func_status getStatus(int ac) const;
64 func_status getStatus(int ac, string const & not_to_use_arg) const;
66 /// The last key was meta
67 bool wasMetaKey() const;
69 // These can't be global because are part of the
70 // internal state (ale970227)
71 /// Get the current keyseq string
72 string const keyseqStr() const;
74 /// Is the key sequence uncomplete?
75 bool keyseqUncomplete() const;
77 /// get options for the current keyseq
78 string const keyseqOptions() const;
80 /// True if lyxfunc reports an error
81 bool errorStat() const { return errorstat; }
82 /// Buffer to store result messages
83 void setMessage(string const & m);
84 /// Buffer to store result messages
85 void setErrorMessage(string const &) const;
86 /// Buffer to store result messages
87 string const getMessage() const { return dispatch_buffer; }
88 /// Handle a accented char keysequenze
89 void handleKeyFunc(kb_action action);
90 /// Should a hint message be displayed?
91 void setHintMessage(bool);
100 kb_sequence cancel_meta_seq;
102 unsigned meta_fake_bit;
104 void moveCursorUpdate(bool flag = true, bool selecting = false);
106 void setupLocalKeymap();
108 kb_action lyx_dead_action;
110 kb_action lyx_calling_dead_action;
111 /// Error status, only Dispatch can change this flag
112 mutable bool errorstat;
114 /** Buffer to store messages and result data. Is there a
115 good reason to have this one as static in Dispatch? (Ale)
117 mutable string dispatch_buffer;
118 /// Command name and shortcut information
119 string commandshortcut;
121 // I think the following should be moved to BufferView. (Asger)
124 void MenuNew(bool fromTemplate);
127 void Open(string const &);
130 void doImport(string const &);
137 // This return or directly text (default) of getLyXText()
139 LyXText * TEXT(bool) const;
141 // This is the same for all lyxfunc objects
146 /*-------------------- inlines --------------------------*/
149 bool LyXFunc::wasMetaKey() const
151 return (meta_fake_bit != 0);
156 string const LyXFunc::keyseqStr() const
158 // Why not just remove this function
160 keyseq.print(text, true);
166 string const LyXFunc::keyseqOptions() const
168 // Why not just remove this function
170 keyseq.printOptions(text);
176 bool LyXFunc::keyseqUncomplete() const
178 return (keyseq.length > 0);
183 void LyXFunc::setHintMessage(bool hm)
190 void operator|=(LyXFunc::func_status & fs, LyXFunc::func_status f)
192 fs = static_cast<LyXFunc::func_status>(fs | f);