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>
33 /** This class encapsulates all the LyX command operations.
34 This is the class of the LyX's "high level event handler".
35 Every user command is processed here, either invocated from
36 keyboard or from the GUI. All GUI objects, including buttons and
37 menus should use this class and never call kernel functions directly.
39 class LyXFunc : public boost::signals::trackable {
45 /// LyX dispatcher, executes lyx actions.
46 void dispatch(FuncRequest const &, bool verbose = false);
48 /// Dispatch via a string argument
49 void dispatch(std::string const & s, bool verbose = false);
51 /// return the status bar state string
52 std::string const view_status_message();
55 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
57 void processKeySym(LyXKeySymPtr key, key_modifier::state state);
60 FuncStatus getStatus(FuncRequest const & action) const;
62 /// The last key was meta
63 bool wasMetaKey() const;
65 /// True if lyxfunc reports an error
66 bool errorStat() const { return errorstat; }
67 /// Buffer to store result messages
68 void setMessage(std::string const & m) const;
69 /// Buffer to store result messages
70 void setErrorMessage(std::string const &) const;
71 /// Buffer to store result messages from getStatus
72 void setStatusMessage(std::string const &) const;
73 /// Buffer to store result messages
74 std::string const getMessage() const { return dispatch_buffer; }
75 /// Buffer to store result messages
76 std::string const getStatusMessage() const { return status_buffer; }
77 /// Handle a accented char key sequence
78 void handleKeyFunc(kb_action action);
82 BufferView * view() const;
87 /// the last character added to the key sequence, in ISO encoded form
88 char encoded_last_key;
93 kb_sequence cancel_meta_seq;
95 key_modifier::state meta_fake_bit;
97 void moveCursorUpdate();
99 void setupLocalKeymap();
100 /// Error status, only Dispatch can change this flag
101 mutable bool errorstat;
103 /** Buffer to store messages and result data. Is there a
104 good reason to have this one as static in Dispatch? (Ale)
106 mutable std::string dispatch_buffer;
107 /** Buffer to store messages and result data from getStatus
109 mutable std::string status_buffer;
111 /// send a post-dispatch status message
112 void sendDispatchMessage(std::string const & msg, FuncRequest const & ev, bool verbose);
114 // I think the following should be moved to BufferView. (Asger)
117 void menuNew(std::string const & argument, bool fromTemplate);
120 void open(std::string const &);
123 void doImport(std::string const &);