9 #include "commandtags.h"
11 #include "insets/lyxinset.h"
16 /** This class encapsulates all the LyX command operations.
17 This is the class of the LyX's "high level event handler".
18 Every user command is processed here, either invocated from
19 keyboard or from the GUI. All GUI objects, including buttons and
20 menus should use this class and never call kernel functions directly.
24 /// The status of a function.
28 Disabled = 2, // Command cannot be executed
36 /// LyX distpatcher, executes lyx actions.
37 string Dispatch(int action, char const * arg = 0);
39 /// The same but uses the name of a lyx command.
40 string Dispatch(string const & cmd);
42 /// A keyboard event is processed to execute a lyx action.
43 int processKeyEvent(XEvent * ev);
46 func_status getStatus(int ac) const;
48 /// The last key was meta
49 bool wasMetaKey() const;
51 // These can't be global because are part of the internat state (ale970227)
52 /// Get the current keyseq string
53 string keyseqStr(int l = 190) const;
55 /// Is the key sequence uncomplete?
56 bool keyseqUncomplete() const;
58 /// get options for the current keyseq
59 string keyseqOptions(int l = 190) const;
61 /// True if lyxfunc reports an error
62 bool errorStat() const { return errorstat; }
63 /// Buffer to store result messages
64 void setMessage(string const & m);
65 /// Buffer to store result messages
66 void setErrorMessage(string const &) const;
67 /// Buffer to store result messages
68 string getMessage() const { return dispatch_buffer; }
69 /// Get next inset of this class from current cursor position
70 Inset * getInsetByCode(Inset::Code);
72 /// Should a hint message be displayed?
73 void setHintMessage(bool);
83 kb_sequence cancel_meta_seq;
85 unsigned meta_fake_bit;
87 void moveCursorUpdate(bool selecting = false);
89 void setupLocalKeymap();
91 kb_action lyx_dead_action;
93 kb_action lyx_calling_dead_action;
94 /// Error status, only Dispatch can change this flag
95 mutable bool errorstat;
97 /** Buffer to store messages and result data. Is there a
98 good reason to have this one as static in Dispatch? (Ale)
100 mutable string dispatch_buffer;
101 /// Command name and shortcut information
102 string commandshortcut;
104 // I think the following should be moved to BufferView. (Asger)
107 void MenuNew(bool fromTemplate);
113 void doImportLaTeX(bool);
116 void doImportASCII(bool);
119 void MenuInsertLyXFile(string const &);
125 /// This is the same for all lyxfunc objects
130 /*-------------------- inlines --------------------------*/
133 bool LyXFunc::wasMetaKey() const
135 return (meta_fake_bit != 0);
140 string LyXFunc::keyseqStr(int l) const
143 keyseq.print(text, l, true);
150 string LyXFunc::keyseqOptions(int l) const
153 keyseq.printOptions(text, l);
160 bool LyXFunc::keyseqUncomplete() const
162 return (keyseq.length > 0);
166 void LyXFunc::setHintMessage(bool hm)