9 #include FORMS_H_LOCATION
10 #include "commandtags.h"
11 #include "kbsequence.h"
12 #include "insets/lyxinset.h"
16 class auto_mem_buffer;
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.
26 /// The status of a function.
32 /// Command cannot be executed
43 /// LyX dispatcher, executes lyx actions.
44 string const Dispatch(int action, string const & arg = string());
46 /// The same but uses the name of a lyx command.
47 string const Dispatch(string const & cmd);
49 /// Same again but for xtl buffers. Still looking for better idea.
50 bool Dispatch(int action, auto_mem_buffer &);
53 /// A keyboard event is processed to execute a lyx action.
54 int processKeyEvent(XEvent * ev);
57 int processKeySym(KeySym k, unsigned int state);
60 func_status getStatus(int ac) const;
62 /// The last key was meta
63 bool wasMetaKey() const;
65 // These can't be global because are part of the
66 // internal state (ale970227)
67 /// Get the current keyseq string
68 string const keyseqStr() const;
70 /// Is the key sequence uncomplete?
71 bool keyseqUncomplete() const;
73 /// get options for the current keyseq
74 string const keyseqOptions() const;
76 /// True if lyxfunc reports an error
77 bool errorStat() const { return errorstat; }
78 /// Buffer to store result messages
79 void setMessage(string const & m);
80 /// Buffer to store result messages
81 void setErrorMessage(string const &) const;
82 /// Buffer to store result messages
83 string const getMessage() const { return dispatch_buffer; }
84 /// Get next inset of this class from current cursor position
85 Inset * getInsetByCode(Inset::Code);
87 /// Should a hint message be displayed?
88 void setHintMessage(bool);
97 kb_sequence cancel_meta_seq;
99 unsigned meta_fake_bit;
101 void moveCursorUpdate(bool selecting = false);
103 void setupLocalKeymap();
105 kb_action lyx_dead_action;
107 kb_action lyx_calling_dead_action;
108 /// Error status, only Dispatch can change this flag
109 mutable bool errorstat;
111 /** Buffer to store messages and result data. Is there a
112 good reason to have this one as static in Dispatch? (Ale)
114 mutable string dispatch_buffer;
115 /// Command name and shortcut information
116 string commandshortcut;
118 // I think the following should be moved to BufferView. (Asger)
121 void MenuNew(bool fromTemplate);
127 void doImport(string const &);
129 void doImportHelper(string const &, string const &, string const &,
130 bool func(BufferView *, string const &) );
133 void MenuInsertLyXFile(string const &);
139 /// This is the same for all lyxfunc objects
144 /*-------------------- inlines --------------------------*/
147 bool LyXFunc::wasMetaKey() const
149 return (meta_fake_bit != 0);
154 string const LyXFunc::keyseqStr() const
156 // Why not just remove this function
158 keyseq.print(text, true);
164 string const LyXFunc::keyseqOptions() const
166 // Why not just remove this function
168 keyseq.printOptions(text);
174 bool LyXFunc::keyseqUncomplete() const
176 return (keyseq.length > 0);
181 void LyXFunc::setHintMessage(bool hm)
188 void operator|=(LyXFunc::func_status & fs, LyXFunc::func_status f)
190 fs = static_cast<LyXFunc::func_status>(fs | f);