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"
22 #include <boost/signals/trackable.hpp>
31 /** This class encapsulates all the LyX command operations.
32 This is the class of the LyX's "high level event handler".
33 Every user command is processed here, either invocated from
34 keyboard or from the GUI. All GUI objects, including buttons and
35 menus should use this class and never call kernel functions directly.
37 class LyXFunc : public boost::signals::trackable {
43 /// LyX dispatcher, executes lyx actions.
44 void dispatch(FuncRequest const &, bool verbose = false);
46 /// Dispatch via a string argument
47 void dispatch(string const & s, bool verbose = false);
49 /// Dispatch via a pseudo action, also displaying shortcut/command name
50 void dispatch(int ac, bool verbose = false);
52 /// return the status bar state string
53 string const view_status_message();
56 void processKeySym(LyXKeySymPtr key, key_modifier::state state);
58 /// we need one internal which is called from inside LyXAction and
59 /// can contain the string argument.
60 FuncStatus getStatus(int ac) const;
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(string const & m) const;
71 /// Buffer to store result messages
72 void setErrorMessage(string const &) const;
73 /// Buffer to store result messages from getStatus
74 void setStatusMessage(string const &) const;
75 /// Buffer to store result messages
76 string const getMessage() const { return dispatch_buffer; }
77 /// Buffer to store result messages
78 string const getStatusMessage() const { return status_buffer; }
79 /// Handle a accented char key sequence
80 void handleKeyFunc(kb_action action);
84 BufferView * view() const;
89 /// the last character added to the key sequence, in ISO encoded form
90 char encoded_last_key;
95 kb_sequence cancel_meta_seq;
97 key_modifier::state meta_fake_bit;
99 void moveCursorUpdate();
101 void setupLocalKeymap();
102 /// Error status, only Dispatch can change this flag
103 mutable bool errorstat;
105 /** Buffer to store messages and result data. Is there a
106 good reason to have this one as static in Dispatch? (Ale)
108 mutable string dispatch_buffer;
109 /** Buffer to store messages and result data from getStatus
111 mutable string status_buffer;
113 /// send a post-dispatch status message
114 void sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose);
116 // I think the following should be moved to BufferView. (Asger)
119 void menuNew(string const & argument, bool fromTemplate);
122 void open(string const &);
125 void doImport(string const &);