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"
20 #include "support/std_string.h"
22 #include <boost/shared_ptr.hpp>
23 #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(string const & s, bool verbose = false);
51 /// Dispatch via a pseudo action, also displaying shortcut/command name
52 void dispatch(int ac, bool verbose = false);
54 /// return the status bar state string
55 string const view_status_message();
58 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
60 void processKeySym(LyXKeySymPtr key, key_modifier::state state);
62 /// we need one internal which is called from inside LyXAction and
63 /// can contain the string argument.
64 FuncStatus getStatus(int ac) const;
66 FuncStatus getStatus(FuncRequest const & action) const;
68 /// The last key was meta
69 bool wasMetaKey() const;
71 /// True if lyxfunc reports an error
72 bool errorStat() const { return errorstat; }
73 /// Buffer to store result messages
74 void setMessage(string const & m) const;
75 /// Buffer to store result messages
76 void setErrorMessage(string const &) const;
77 /// Buffer to store result messages from getStatus
78 void setStatusMessage(string const &) const;
79 /// Buffer to store result messages
80 string const getMessage() const { return dispatch_buffer; }
81 /// Buffer to store result messages
82 string const getStatusMessage() const { return status_buffer; }
83 /// Handle a accented char key sequence
84 void handleKeyFunc(kb_action action);
88 BufferView * view() const;
93 /// the last character added to the key sequence, in ISO encoded form
94 char encoded_last_key;
99 kb_sequence cancel_meta_seq;
101 key_modifier::state meta_fake_bit;
103 void moveCursorUpdate();
105 void setupLocalKeymap();
106 /// Error status, only Dispatch can change this flag
107 mutable bool errorstat;
109 /** Buffer to store messages and result data. Is there a
110 good reason to have this one as static in Dispatch? (Ale)
112 mutable string dispatch_buffer;
113 /** Buffer to store messages and result data from getStatus
115 mutable string status_buffer;
117 /// send a post-dispatch status message
118 void sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose);
120 // I think the following should be moved to BufferView. (Asger)
123 void menuNew(string const & argument, bool fromTemplate);
126 void open(string const &);
129 void doImport(string const &);