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 /// Dispatch via a pseudo action, also displaying shortcut/command name
53 void dispatch(int ac, bool verbose = false);
55 /// return the status bar state string
56 string const view_status_message();
59 typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
61 void processKeySym(LyXKeySymPtr key, key_modifier::state state);
63 /// we need one internal which is called from inside LyXAction and
64 /// can contain the string argument.
65 FuncStatus getStatus(int ac) const;
67 FuncStatus getStatus(FuncRequest const & action) const;
69 /// The last key was meta
70 bool wasMetaKey() const;
72 /// True if lyxfunc reports an error
73 bool errorStat() const { return errorstat; }
74 /// Buffer to store result messages
75 void setMessage(string const & m) const;
76 /// Buffer to store result messages
77 void setErrorMessage(string const &) const;
78 /// Buffer to store result messages from getStatus
79 void setStatusMessage(string const &) const;
80 /// Buffer to store result messages
81 string const getMessage() const { return dispatch_buffer; }
82 /// Buffer to store result messages
83 string const getStatusMessage() const { return status_buffer; }
84 /// Handle a accented char key sequence
85 void handleKeyFunc(kb_action action);
89 BufferView * view() const;
94 /// the last character added to the key sequence, in ISO encoded form
95 char encoded_last_key;
100 kb_sequence cancel_meta_seq;
102 key_modifier::state meta_fake_bit;
104 void moveCursorUpdate();
106 void setupLocalKeymap();
107 /// Error status, only Dispatch can change this flag
108 mutable bool errorstat;
110 /** Buffer to store messages and result data. Is there a
111 good reason to have this one as static in Dispatch? (Ale)
113 mutable string dispatch_buffer;
114 /** Buffer to store messages and result data from getStatus
116 mutable string status_buffer;
118 /// send a post-dispatch status message
119 void sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose);
121 // I think the following should be moved to BufferView. (Asger)
124 void menuNew(string const & argument, bool fromTemplate);
127 void open(string const &);
130 void doImport(string const &);