]> git.lyx.org Git - lyx.git/blob - src/lyxfunc.h
remove mention of lyxrc from the splash
[lyx.git] / src / lyxfunc.h
1 // -*- C++ -*-
2 #ifndef LYXFUNC_H
3 #define LYXFUNC_H
4
5 #include "FuncStatus.h"
6 #include "kbsequence.h"
7 #include "lfuns.h"
8 #include "LString.h"
9
10 #include <boost/signals/trackable.hpp>
11
12 class LyXView;
13 class LyXText;
14 class FuncRequest;
15 class BufferView;
16
17
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.
23 */
24 class LyXFunc : public boost::signals::trackable {
25 public:
26         ///
27         explicit
28         LyXFunc(LyXView *);
29
30         /// LyX dispatcher, executes lyx actions.
31         void dispatch(FuncRequest const &, bool verbose = false);
32
33         /// Dispatch via a string argument
34         void dispatch(string const & s, bool verbose = false);
35
36         /// Dispatch via a pseudo action, also displaying shortcut/command name
37         void dispatch(int ac, bool verbose = false);
38
39         /// return the status bar state string
40         string const view_status_message();
41
42         ///
43         void processKeySym(LyXKeySymPtr key, key_modifier::state state);
44
45         /// we need one internal which is called from inside LyXAction and
46         /// can contain the string argument.
47         FuncStatus getStatus(int ac) const;
48         ///
49         FuncStatus getStatus(FuncRequest const & action) const;
50
51         /// The last key was meta
52         bool wasMetaKey() const;
53
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);
68
69 private:
70         ///
71         BufferView * view() const;
72
73         ///
74         LyXView * owner;
75
76         /// the last character added to the key sequence, in ISO encoded form
77         char encoded_last_key;
78
79         ///
80         kb_sequence keyseq;
81         ///
82         kb_sequence cancel_meta_seq;
83         ///
84         key_modifier::state meta_fake_bit;
85         ///
86         void moveCursorUpdate(bool flag = true, bool selecting = false);
87         ///
88         void setupLocalKeymap();
89         /// Error status, only Dispatch can change this flag
90         mutable bool errorstat;
91
92         /** Buffer to store messages and result data. Is there a
93             good reason to have this one as static in Dispatch? (Ale)
94         */
95         mutable string dispatch_buffer;
96         /** Buffer to store messages and result data from getStatus
97         */
98         mutable string status_buffer;
99
100         /// send a post-dispatch status message
101         void sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose);
102
103         // I think the following should be moved to BufferView. (Asger)
104
105         ///
106         void menuNew(string const & argument, bool fromTemplate);
107
108         ///
109         void open(string const &);
110
111         ///
112         void doImport(string const &);
113
114         ///
115         void closeBuffer();
116         ///
117         //  This return or directly text (default) of getLyXText()
118         ///
119         LyXText * TEXT(bool) const;
120         ///
121 };
122
123
124 /*--------------------  inlines  --------------------------*/
125
126 inline
127 bool LyXFunc::wasMetaKey() const
128 {
129         return (meta_fake_bit != key_modifier::none);
130 }
131
132
133 #endif