9 #include "commandtags.h"
11 #include "tex-accent.h"
12 #include "LyXAction.h"
13 #include "insets/lyxinset.h"
18 /** This class encapsulates all the LyX command operations.
19 This is the class of the LyX's "high level event handler".
20 Every user command is processed here, either invocated from
21 keyboard or from the GUI. All GUI objects, including buttons and
22 menus should use this class and never call kernel functions directly.
31 /// LyX distpatcher, executes lyx actions.
32 LString Dispatch(int action, char const* arg = 0);
34 /// The same but uses the name of a lyx command.
35 LString Dispatch(LString const &cmd, LString const &arg = LString());
38 /// A keyboard event is processed to execute a lyx action.
39 int processKeyEvent(XEvent *ev);
41 /// The last key was meta
44 // These can't be global because are part of the internat state (ale970227)
45 /// Get the current keyseq string
46 LString keyseqStr(int l=190);
48 /// Is the key sequence uncomplete?
49 bool keyseqUncomplete();
51 /// get options for the current keyseq
52 LString keyseqOptions(int l=190);
54 /// Returns the name of a funcion given a keyseq
55 char const* getFunc(char*)
56 { /* unimplemented */ return 0; }
58 /// Return a string with the keybind to an action, if any
59 char const* getKeybind(int)
60 { /* unimplemented */ return 0; }
62 /// True if lyxfunc reports an error
63 bool errorStat() const { return errorstat; }
64 /// Buffer to store result messages
65 void setMessage(LString const &m);
66 /// Buffer to store result messages
67 void setErrorMessage(LString const &);
68 /// Buffer to store result messages
69 LString getMessage() const { return dispatch_buffer; }
70 /// Get next inset of this class from current cursor position
71 Inset* getInsetByCode(Inset::Code);
73 /// Should a hint message be displayed?
74 void setHintMessage(bool);
78 LString argAsString(char const *const argument);
82 static kb_func_table* lyx_func_table;
84 static kb_func_table *lyx_func_args;
90 kb_sequence cancel_meta_seq;
92 unsigned meta_fake_bit;
94 void moveCursorUpdate(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
104 /** Buffer to store messages and result data. Is there a
105 good reason to have this one as static in Dispatch? (Ale)
107 LString dispatch_buffer;
108 /// Command name and shortcut information
109 LString commandshortcut;
111 // I think the following should be moved to BufferView. (Asger)
114 void MenuNew(bool fromTemplate);
120 void doImportLaTeX(bool);
123 void doImportASCII(bool);
126 void MenuInsertLyXFile(LString const &);
132 /// This is the same for all lyxfunc objects
137 /*-------------------- inlines --------------------------*/
140 bool LyXFunc::wasMetaKey()
142 return (meta_fake_bit != 0);
147 LString LyXFunc::keyseqStr(int l)
150 keyseq.print(text, l, true);
157 LString LyXFunc::keyseqOptions(int l)
160 keyseq.printOptions(text, l);
167 bool LyXFunc::keyseqUncomplete()
169 return (keyseq.length > 0);
173 void LyXFunc::setHintMessage(bool hm)