4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
10 * \author André Pönitz
12 * Full author contact details are available in file CREDITS.
18 #include "KeySequence.h"
21 #include "support/docstring.h"
42 /** This class encapsulates all the LyX command operations.
43 This is the class of the LyX's "high level event handler".
44 Every user command is processed here, either invocated from
45 keyboard or from the GUI. All GUI objects, including buttons and
46 menus should use this class and never call kernel functions directly.
54 /// LyX dispatcher, executes lyx actions.
55 void dispatch(FuncRequest const &);
58 void setLyXView(frontend::LyXView * lv);
61 void initKeySequences(KeyMap * kb);
63 /// return the status bar state string
64 docstring const viewStatusMessage();
67 void processKeySym(KeySymbol const & key, KeyModifier state);
70 FuncStatus getStatus(FuncRequest const & action) const;
72 /// The last key was meta
73 bool wasMetaKey() const;
75 /// True if lyxfunc reports an error
76 bool errorStat() const { return errorstat; }
77 /// Buffer to store result messages
78 void setMessage(docstring const & m) const;
79 /// Buffer to store result messages
80 void setErrorMessage(docstring const &) const;
81 /// Buffer to store result messages
82 docstring const getMessage() const { return dispatch_buffer; }
83 /// Handle a accented char key sequence
84 void handleKeyFunc(kb_action action);
86 /// openFile: whether or not open a file if the file is not opened
87 /// switchToBuffer: whether or not switch to buffer if the buffer is
88 /// not the current buffer
89 void gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer);
91 /// cursor x position before dispatch started
92 int cursorBeforeDispatchX() const {
93 return cursorPosBeforeDispatchX_;
95 /// cursor y position before dispatch started
96 int cursorBeforeDispatchY() const {
97 return cursorPosBeforeDispatchY_;
102 BufferView * view() const;
105 frontend::LyXView * lyx_view_;
107 /// the last character added to the key sequence, in UCS4 encoded form
108 char_type encoded_last_key;
113 KeySequence cancel_meta_seq;
115 KeyModifier meta_fake_bit;
117 /// cursor position before dispatch started
118 int cursorPosBeforeDispatchX_;
119 int cursorPosBeforeDispatchY_;
121 /// Error status, only Dispatch can change this flag
122 mutable bool errorstat;
124 /** Buffer to store messages and result data. Is there a
125 good reason to have this one as static in Dispatch? (Ale)
127 mutable docstring dispatch_buffer;
129 /// send a post-dispatch status message
130 void sendDispatchMessage(docstring const & msg,
131 FuncRequest const & ev);
138 bool ensureBufferClean(BufferView * bv);
140 void updateLayout(TextClassIndex const & oldlayout, Buffer * buffer);
143 /// Implementation is in LyX.cpp
144 extern LyXFunc & theLyXFunc();
146 /// Implementation is in LyX.cpp
147 extern FuncStatus getStatus(FuncRequest const & action);
149 /// Implementation is in LyX.cpp
150 extern void dispatch(FuncRequest const & action);