5 #include "FuncStatus.h"
6 #include "kbsequence.h"
10 #include <boost/signals/trackable.hpp>
18 /** This class encapsulates all the LyX command operations.
19 This is the class of the LyX's "high level event handler".
20 Every user command is processed here, either invocated from
21 keyboard or from the GUI. All GUI objects, including buttons and
22 menus should use this class and never call kernel functions directly.
24 class LyXFunc
: public boost::signals::trackable
{
30 /// LyX dispatcher, executes lyx actions.
31 void dispatch(FuncRequest
const &, bool verbose
= false);
33 /// Dispatch via a string argument
34 void dispatch(string
const & s
, bool verbose
= false);
36 /// Dispatch via a pseudo action, also displaying shortcut/command name
37 void dispatch(int ac
, bool verbose
= false);
39 /// return the status bar state string
40 string
const view_status_message();
43 void processKeySym(LyXKeySymPtr key
, key_modifier::state state
);
45 /// we need one internal which is called from inside LyXAction and
46 /// can contain the string argument.
47 FuncStatus
getStatus(int ac
) const;
49 FuncStatus
getStatus(FuncRequest
const & action
) const;
51 /// The last key was meta
52 bool wasMetaKey() const;
54 /// True if lyxfunc reports an error
55 bool errorStat() const { return errorstat
; }
56 /// Buffer to store result messages
57 void setMessage(string
const & m
) const;
58 /// Buffer to store result messages
59 void setErrorMessage(string
const &) const;
60 /// Buffer to store result messages from getStatus
61 void setStatusMessage(string
const &) const;
62 /// Buffer to store result messages
63 string
const getMessage() const { return dispatch_buffer
; }
64 /// Buffer to store result messages
65 string
const getStatusMessage() const { return status_buffer
; }
66 /// Handle a accented char key sequence
67 void handleKeyFunc(kb_action action
);
71 BufferView
* view() const;
76 /// the last character added to the key sequence, in ISO encoded form
77 char encoded_last_key
;
82 kb_sequence cancel_meta_seq
;
84 key_modifier::state meta_fake_bit
;
86 void moveCursorUpdate(bool flag
= true, bool selecting
= false);
88 void setupLocalKeymap();
89 /// Error status, only Dispatch can change this flag
90 mutable bool errorstat
;
92 /** Buffer to store messages and result data. Is there a
93 good reason to have this one as static in Dispatch? (Ale)
95 mutable string dispatch_buffer
;
96 /** Buffer to store messages and result data from getStatus
98 mutable string status_buffer
;
100 /// send a post-dispatch status message
101 void sendDispatchMessage(string
const & msg
, FuncRequest
const & ev
, bool verbose
);
103 // I think the following should be moved to BufferView. (Asger)
106 void menuNew(string
const & argument
, bool fromTemplate
);
109 void open(string
const &);
112 void doImport(string
const &);
117 // This return or directly text (default) of getLyXText()
119 LyXText
* TEXT(bool) const;
124 /*-------------------- inlines --------------------------*/
127 bool LyXFunc::wasMetaKey() const
129 return (meta_fake_bit
!= key_modifier::none
);