1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
1999-10-07 18:44:17 +00:00
|
|
|
#ifndef LYXFUNC_H
|
|
|
|
#define LYXFUNC_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma interface
|
|
|
|
#endif
|
|
|
|
|
2001-07-29 17:39:01 +00:00
|
|
|
|
2002-01-09 09:36:35 +00:00
|
|
|
#include "FuncStatus.h"
|
2000-02-04 09:38:32 +00:00
|
|
|
#include "kbsequence.h"
|
2002-08-07 08:11:41 +00:00
|
|
|
#include "commandtags.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "LString.h"
|
1999-11-22 16:19:48 +00:00
|
|
|
|
2002-05-29 16:21:03 +00:00
|
|
|
#include <boost/signals/trackable.hpp>
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
class LyXView;
|
2001-07-29 17:39:01 +00:00
|
|
|
class LyXText;
|
2002-08-07 08:11:41 +00:00
|
|
|
class FuncRequest;
|
2001-04-17 15:15:59 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
/** This class encapsulates all the LyX command operations.
|
1999-09-27 18:44:28 +00:00
|
|
|
This is the class of the LyX's "high level event handler".
|
|
|
|
Every user command is processed here, either invocated from
|
|
|
|
keyboard or from the GUI. All GUI objects, including buttons and
|
|
|
|
menus should use this class and never call kernel functions directly.
|
|
|
|
*/
|
2002-05-29 16:21:03 +00:00
|
|
|
class LyXFunc : public boost::signals::trackable {
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
explicit
|
1999-11-22 16:19:48 +00:00
|
|
|
LyXFunc(LyXView *);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
/// LyX dispatcher, executes lyx actions.
|
2002-08-07 08:11:41 +00:00
|
|
|
void dispatch(FuncRequest const &, bool verbose = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2002-07-18 20:15:29 +00:00
|
|
|
/// Dispatch via a string argument
|
|
|
|
void dispatch(string const & s, bool verbose = false);
|
|
|
|
|
|
|
|
/// Dispatch via a pseudo action, also displaying shortcut/command name
|
|
|
|
void dispatch(int ac, bool verbose = false);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2002-07-18 20:15:29 +00:00
|
|
|
/// return the status bar state string
|
|
|
|
string const view_status_message();
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-08-14 15:31:16 +00:00
|
|
|
///
|
2002-06-18 15:44:30 +00:00
|
|
|
void processKeySym(LyXKeySymPtr key, key_modifier::state state);
|
2000-11-04 10:00:12 +00:00
|
|
|
|
2002-01-12 20:00:47 +00:00
|
|
|
/// we need one internal which is called from inside LyXAction and
|
2001-02-26 10:32:45 +00:00
|
|
|
/// can contain the string argument.
|
2002-01-09 09:36:35 +00:00
|
|
|
FuncStatus getStatus(int ac) const;
|
2001-05-16 07:53:23 +00:00
|
|
|
///
|
2002-08-07 08:11:41 +00:00
|
|
|
FuncStatus getStatus(FuncRequest const & action) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// The last key was meta
|
1999-11-22 16:19:48 +00:00
|
|
|
bool wasMetaKey() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
/// True if lyxfunc reports an error
|
|
|
|
bool errorStat() const { return errorstat; }
|
|
|
|
/// Buffer to store result messages
|
|
|
|
void setMessage(string const & m) const;
|
|
|
|
/// Buffer to store result messages
|
|
|
|
void setErrorMessage(string const &) const;
|
|
|
|
/// Buffer to store result messages from getStatus
|
|
|
|
void setStatusMessage(string const &) const;
|
|
|
|
/// Buffer to store result messages
|
|
|
|
string const getMessage() const { return dispatch_buffer; }
|
|
|
|
/// Buffer to store result messages
|
|
|
|
string const getStatusMessage() const { return status_buffer; }
|
2002-06-18 15:44:30 +00:00
|
|
|
/// Handle a accented char key sequence
|
2001-02-23 16:10:03 +00:00
|
|
|
void handleKeyFunc(kb_action action);
|
2002-01-12 20:00:47 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
|
|
|
///
|
1999-11-22 16:19:48 +00:00
|
|
|
LyXView * owner;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
static int psd_idx;
|
2002-03-21 17:27:08 +00:00
|
|
|
///
|
|
|
|
kb_sequence keyseq;
|
|
|
|
///
|
|
|
|
kb_sequence cancel_meta_seq;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2002-05-26 17:33:14 +00:00
|
|
|
key_modifier::state meta_fake_bit;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-02-22 14:09:20 +00:00
|
|
|
void moveCursorUpdate(bool flag = true, bool selecting = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void setupLocalKeymap();
|
2002-03-21 17:27:08 +00:00
|
|
|
///
|
|
|
|
kb_action lyx_dead_action;
|
|
|
|
///
|
|
|
|
kb_action lyx_calling_dead_action;
|
|
|
|
/// Error status, only Dispatch can change this flag
|
|
|
|
mutable bool errorstat;
|
|
|
|
|
|
|
|
/** Buffer to store messages and result data. Is there a
|
1999-12-16 06:43:25 +00:00
|
|
|
good reason to have this one as static in Dispatch? (Ale)
|
|
|
|
*/
|
2002-03-21 17:27:08 +00:00
|
|
|
mutable string dispatch_buffer;
|
|
|
|
/** Buffer to store messages and result data from getStatus
|
2002-01-13 13:07:27 +00:00
|
|
|
*/
|
2002-03-21 17:27:08 +00:00
|
|
|
mutable string status_buffer;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2002-07-18 20:15:29 +00:00
|
|
|
/// send a post-dispatch status message
|
2002-08-07 08:11:41 +00:00
|
|
|
void sendDispatchMessage(string const & msg, FuncRequest const & ev, bool verbose);
|
2002-07-18 20:15:29 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
// I think the following should be moved to BufferView. (Asger)
|
|
|
|
|
|
|
|
///
|
2002-07-11 15:13:21 +00:00
|
|
|
void menuNew(string const & argument, bool fromTemplate);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2001-07-16 15:42:57 +00:00
|
|
|
void open(string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2000-04-28 11:18:04 +00:00
|
|
|
void doImport(string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2001-07-16 15:42:57 +00:00
|
|
|
void closeBuffer();
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
|
|
|
void reloadBuffer();
|
2001-02-22 14:09:20 +00:00
|
|
|
///
|
|
|
|
// This return or directly text (default) of getLyXText()
|
|
|
|
///
|
|
|
|
LyXText * TEXT(bool) const;
|
|
|
|
///
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
2002-03-21 17:27:08 +00:00
|
|
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/*-------------------- inlines --------------------------*/
|
|
|
|
|
|
|
|
inline
|
2002-03-21 17:27:08 +00:00
|
|
|
bool LyXFunc::wasMetaKey() const
|
|
|
|
{
|
2002-05-26 17:33:14 +00:00
|
|
|
return (meta_fake_bit != key_modifier::none);
|
1999-09-27 18:44:28 +00:00
|
|
|
}
|
2002-03-21 17:27:08 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
#endif
|