9 #include "commandtags.h"
11 #include "tex-accent.h"
12 #include "LyXAction.h"
13 #include "insets/lyxinset.h"
17 /** This class encapsulates all the LyX command operations.
18 This is the class of the LyX's "high level event handler".
19 Every user command is processed here, either invocated from
20 keyboard or from the GUI. All GUI objects, including buttons and
21 menus should use this class and never call kernel functions directly.
30 /// LyX distpatcher, executes lyx actions.
31 string
Dispatch(int action
, char const* arg
= 0);
33 /// The same but uses the name of a lyx command.
34 string
Dispatch(string
const &cmd
, string
const &arg
= string());
37 /// A keyboard event is processed to execute a lyx action.
38 int processKeyEvent(XEvent
*ev
);
40 /// The last key was meta
43 // These can't be global because are part of the internat state (ale970227)
44 /// Get the current keyseq string
45 string
keyseqStr(int l
=190);
47 /// Is the key sequence uncomplete?
48 bool keyseqUncomplete();
50 /// get options for the current keyseq
51 string
keyseqOptions(int l
=190);
53 /// Returns the name of a funcion given a keyseq
54 char const* getFunc(char*)
55 { /* unimplemented */ return 0; }
57 /// Return a string with the keybind to an action, if any
58 char const* getKeybind(int)
59 { /* unimplemented */ return 0; }
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 &);
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);
79 static kb_func_table
* lyx_func_table
;
81 static kb_func_table
*lyx_func_args
;
87 kb_sequence cancel_meta_seq
;
89 unsigned meta_fake_bit
;
91 void moveCursorUpdate(bool selecting
= false);
93 void setupLocalKeymap();
95 kb_action lyx_dead_action
;
97 kb_action lyx_calling_dead_action
;
98 /// Error status, only Dispatch can change this flag
101 /** Buffer to store messages and result data. Is there a
102 good reason to have this one as static in Dispatch? (Ale)
104 string dispatch_buffer
;
105 /// Command name and shortcut information
106 string commandshortcut
;
108 // I think the following should be moved to BufferView. (Asger)
111 void MenuNew(bool fromTemplate
);
117 void doImportLaTeX(bool);
120 void doImportASCII(bool);
123 void MenuInsertLyXFile(string
const &);
129 /// This is the same for all lyxfunc objects
134 /*-------------------- inlines --------------------------*/
137 bool LyXFunc::wasMetaKey()
139 return (meta_fake_bit
!= 0);
144 string
LyXFunc::keyseqStr(int l
)
147 keyseq
.print(text
, l
, true);
154 string
LyXFunc::keyseqOptions(int l
)
157 keyseq
.printOptions(text
, l
);
164 bool LyXFunc::keyseqUncomplete()
166 return (keyseq
.length
> 0);
170 void LyXFunc::setHintMessage(bool hm
)