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.
19 #include "KeySequence.h"
21 #include "support/docstring.h"
37 /** This class encapsulates all the LyX command operations.
38 This is the class of the LyX's "high level event handler".
39 Every user command is processed here, either invocated from
40 keyboard or from the GUI. All GUI objects, including buttons and
41 menus should use this class and never call kernel functions directly.
49 /// LyX dispatcher, executes lyx actions.
50 void dispatch(FuncRequest const &);
53 void initKeySequences(KeyMap * kb);
55 /// return the status bar state string
56 docstring viewStatusMessage();
59 void processKeySym(KeySymbol const & key, KeyModifier state);
62 FuncStatus getStatus(FuncRequest const & action) const;
64 /// The last key was meta
65 bool wasMetaKey() const;
67 /// True if lyxfunc reports an error
68 bool errorStat() const { return errorstat; }
69 /// Buffer to store result messages
70 void setMessage(docstring const & m) const;
71 /// Buffer to store result messages
72 void setErrorMessage(docstring const &) const;
73 /// Buffer to store result messages
74 docstring const getMessage() const { return dispatch_buffer; }
75 /// Handle a accented char key sequence
76 void handleKeyFunc(FuncCode action);
78 /// openFile: whether or not open a file if the file is not opened
79 /// switchToBuffer: whether or not switch to buffer if the buffer is
80 /// not the current buffer
81 void gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer);
83 /// cursor x position before dispatch started
84 int cursorBeforeDispatchX() const { return cursorPosBeforeDispatchX_; }
85 /// cursor y position before dispatch started
86 int cursorBeforeDispatchY() const { return cursorPosBeforeDispatchY_; }
89 /// the last character added to the key sequence, in UCS4 encoded form
90 char_type encoded_last_key;
95 KeySequence cancel_meta_seq;
97 KeyModifier meta_fake_bit;
99 /// cursor position before dispatch started
100 int cursorPosBeforeDispatchX_;
101 int cursorPosBeforeDispatchY_;
103 /// Error status, only Dispatch can change this flag
104 mutable bool errorstat;
106 /** Buffer to store messages and result data. Is there a
107 good reason to have this one as static in Dispatch? (Ale)
109 mutable docstring dispatch_buffer;
111 /// send a post-dispatch status message
112 void sendDispatchMessage(docstring const & msg,
113 FuncRequest const & ev);
116 /// Implementation is in LyX.cpp
117 extern LyXFunc & theLyXFunc();
119 /// Implementation is in LyX.cpp
120 extern FuncStatus getStatus(FuncRequest const & action);
122 /// Implementation is in LyX.cpp
123 extern void dispatch(FuncRequest const & action);