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
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <sigc++/signal_system.h>
|
|
|
|
|
|
|
|
#include "commandtags.h" // for kb_action enum
|
2002-01-09 09:36:35 +00:00
|
|
|
#include "FuncStatus.h"
|
2000-02-04 09:38:32 +00:00
|
|
|
#include "kbsequence.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
#include "LString.h"
|
1999-11-22 16:19:48 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
class LyXView;
|
2001-07-29 17:39:01 +00:00
|
|
|
class LyXText;
|
2001-04-17 15:15:59 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** This class encapsulates all the LyX command operations.
|
|
|
|
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.
|
|
|
|
*/
|
2001-04-17 15:15:59 +00:00
|
|
|
class LyXFunc : public SigC::Object {
|
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 *);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
/// LyX dispatcher, executes lyx actions.
|
2002-01-12 20:00:47 +00:00
|
|
|
string const dispatch(kb_action ac, string argument = string());
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2002-01-12 20:00:47 +00:00
|
|
|
/// The same as dispatch, but also shows shortcuts and command
|
|
|
|
/// name in minibuffer if show_sc is true (more to come?)
|
|
|
|
void const LyXFunc::verboseDispatch(kb_action action,
|
|
|
|
string const & argument,
|
|
|
|
bool show_sc);
|
|
|
|
|
|
|
|
/// Same as above, using a pseudoaction as argument
|
|
|
|
void const LyXFunc::verboseDispatch(int ac, bool show_sc);
|
|
|
|
|
|
|
|
/// Same as above, when the command is provided as a string
|
|
|
|
void const LyXFunc::verboseDispatch(string const & s, bool show_sc);
|
|
|
|
|
|
|
|
///
|
|
|
|
void LyXFunc::miniDispatch(string const & s);
|
2000-06-12 11:55:12 +00:00
|
|
|
|
2001-04-17 15:15:59 +00:00
|
|
|
///
|
|
|
|
void initMiniBuffer();
|
|
|
|
|
2000-08-14 15:31:16 +00:00
|
|
|
///
|
2001-05-17 01:23:29 +00:00
|
|
|
void processKeySym(KeySym k, unsigned int 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-01-12 20:00:47 +00:00
|
|
|
FuncStatus getStatus(kb_action action,
|
|
|
|
string const & argument = string()) const;
|
1999-11-22 16:19:48 +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
|
|
|
|
|
|
|
/// True if lyxfunc reports an error
|
|
|
|
bool errorStat() const { return errorstat; }
|
|
|
|
/// Buffer to store result messages
|
1999-11-22 16:19:48 +00:00
|
|
|
void setMessage(string const & m);
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Buffer to store result messages
|
1999-11-22 16:19:48 +00:00
|
|
|
void setErrorMessage(string const &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Buffer to store result messages
|
2000-09-14 17:53:12 +00:00
|
|
|
string const getMessage() const { return dispatch_buffer; }
|
2001-02-23 16:10:03 +00:00
|
|
|
/// Handle a accented char keysequenze
|
|
|
|
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;
|
|
|
|
///
|
|
|
|
kb_sequence keyseq;
|
|
|
|
///
|
|
|
|
kb_sequence cancel_meta_seq;
|
|
|
|
///
|
|
|
|
unsigned meta_fake_bit;
|
|
|
|
///
|
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();
|
|
|
|
///
|
|
|
|
kb_action lyx_dead_action;
|
|
|
|
///
|
|
|
|
kb_action lyx_calling_dead_action;
|
|
|
|
/// Error status, only Dispatch can change this flag
|
1999-11-22 16:19:48 +00:00
|
|
|
mutable bool errorstat;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** 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)
|
|
|
|
*/
|
1999-11-22 16:19:48 +00:00
|
|
|
mutable string dispatch_buffer;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Command name and shortcut information
|
1999-10-02 16:21:10 +00:00
|
|
|
string commandshortcut;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
// I think the following should be moved to BufferView. (Asger)
|
|
|
|
|
|
|
|
///
|
2001-07-16 15:42:57 +00:00
|
|
|
void menuNew(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
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------- inlines --------------------------*/
|
|
|
|
|
|
|
|
inline
|
1999-11-22 16:19:48 +00:00
|
|
|
bool LyXFunc::wasMetaKey() const
|
1999-09-27 18:44:28 +00:00
|
|
|
{
|
|
|
|
return (meta_fake_bit != 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|