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 "kbsequence.h"
21 #include <boost/shared_ptr.hpp>
22 #include <boost/signals/trackable.hpp>
24 #include "support/std_string.h"
34 /** This class encapsulates all the LyX command operations.
35 This is the class of the LyX's "high level event handler".
36 Every user command is processed here, either invocated from
37 keyboard or from the GUI. All GUI objects, including buttons and
38 menus should use this class and never call kernel functions directly.
40 class LyXFunc : public boost::signals::trackable {
46 /// LyX dispatcher, executes lyx actions.
47 void dispatch(FuncRequest const &, bool verbose = false);
49 /// Dispatch via a string argument
50 void dispatch(string const & s, bool verbose = false);
52 /// return the status bar state string
53 string const view_status_message();
56 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
58 void processKeySym(LyXKeySymPtr key, key_modifier::state state);
61 FuncStatus getStatus(FuncRequest const & action) const;
63 /// The last key was meta
64 bool wasMetaKey() const;
66 /// True if lyxfunc reports an error
67 bool errorStat() const { return errorstat; }
68 /// Buffer to store result messages
69 void setMessage(string const & m) const;
70 /// Buffer to store result messages
71 void setErrorMessage(string const &) const;
72 /// Buffer to store result messages from getStatus
73 void setStatusMessage(string const &) const;
74 /// Buffer to store result messages
75 string const getMessage() const { return dispatch_buffer; }
76 /// Buffer to store result messages
77 string const getStatusMessage() const { return status_buffer; }
78 /// Handle a accented char key sequence
79 void handleKeyFunc(kb_action action);
83 BufferView * view() const;
88 /// the last character added to the key sequence, in ISO encoded form
89 char encoded_last_key;
94 kb_sequence cancel_meta_seq;
96 key_modifier::state meta_fake_bit;
98 void moveCursorUpdate();
100 void setupLocalKeymap();
101 /// Error status, only Dispatch can change this flag
102 mutable bool errorstat;
104 /** Buffer to store messages and result data. Is there a
105 good reason to have this one as static in Dispatch? (Ale)
107 mutable string dispatch_buffer;
108 /** Buffer to store messages and result data from getStatus
110 mutable string status_buffer;
112 /// send a post-dispatch status message
113 void sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose);
115 // I think the following should be moved to BufferView. (Asger)
118 void menuNew(string const & argument, bool fromTemplate);
121 void open(string const &);
124 void doImport(string const &);