]> git.lyx.org Git - lyx.git/blob - src/lyxfunc.h
Add In nsetOld * argument to updateInset to rebreak the correct par.
[lyx.git] / src / lyxfunc.h
1 // -*- C++ -*-
2 /**
3  * \file lyxfunc.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Jean-Marc Lasgouttes
9  * \author John Levon
10  * \author André Pönitz
11  *
12  * Full author contact details are available in file CREDITS.
13  */
14
15 #ifndef LYXFUNC_H
16 #define LYXFUNC_H
17
18 #include "FuncStatus.h"
19 #include "kbsequence.h"
20 #include "lfuns.h"
21 #include "LString.h"
22
23 #include <boost/signals/trackable.hpp>
24
25 class LyXView;
26 class LyXText;
27 class FuncRequest;
28 class BufferView;
29
30
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.
36 */
37 class LyXFunc : public boost::signals::trackable {
38 public:
39         ///
40         explicit
41         LyXFunc(LyXView *);
42
43         /// LyX dispatcher, executes lyx actions.
44         void dispatch(FuncRequest const &, bool verbose = false);
45
46         /// Dispatch via a string argument
47         void dispatch(string const & s, bool verbose = false);
48
49         /// Dispatch via a pseudo action, also displaying shortcut/command name
50         void dispatch(int ac, bool verbose = false);
51
52         /// return the status bar state string
53         string const view_status_message();
54
55         ///
56         void processKeySym(LyXKeySymPtr key, key_modifier::state state);
57
58         /// we need one internal which is called from inside LyXAction and
59         /// can contain the string argument.
60         FuncStatus getStatus(int ac) const;
61         ///
62         FuncStatus getStatus(FuncRequest const & action) const;
63
64         /// The last key was meta
65         bool wasMetaKey() const;
66
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);
81
82 private:
83         ///
84         BufferView * view() const;
85
86         ///
87         LyXView * owner;
88
89         /// the last character added to the key sequence, in ISO encoded form
90         char encoded_last_key;
91
92         ///
93         kb_sequence keyseq;
94         ///
95         kb_sequence cancel_meta_seq;
96         ///
97         key_modifier::state meta_fake_bit;
98         ///
99         void moveCursorUpdate();
100         ///
101         void setupLocalKeymap();
102         /// Error status, only Dispatch can change this flag
103         mutable bool errorstat;
104
105         /** Buffer to store messages and result data. Is there a
106             good reason to have this one as static in Dispatch? (Ale)
107         */
108         mutable string dispatch_buffer;
109         /** Buffer to store messages and result data from getStatus
110         */
111         mutable string status_buffer;
112
113         /// send a post-dispatch status message
114         void sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose);
115
116         // I think the following should be moved to BufferView. (Asger)
117
118         ///
119         void menuNew(string const & argument, bool fromTemplate);
120
121         ///
122         void open(string const &);
123
124         ///
125         void doImport(string const &);
126
127         ///
128         void closeBuffer();
129 };
130
131 #endif