1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
2003-08-23 00:17:00 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file LyXFunc.h
|
2003-08-23 00:17:00 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2003-08-23 00:17:00 +00:00
|
|
|
* \author Jean-Marc Lasgouttes
|
|
|
|
* \author John Levon
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2003-08-23 00:17:00 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
1999-10-07 18:44:17 +00:00
|
|
|
#ifndef LYXFUNC_H
|
|
|
|
#define LYXFUNC_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2008-03-15 01:20:36 +00:00
|
|
|
#include "FuncCode.h"
|
2007-04-27 08:19:12 +00:00
|
|
|
#include "KeySequence.h"
|
1999-11-22 16:19:48 +00:00
|
|
|
|
2006-09-13 21:13:49 +00:00
|
|
|
#include "support/docstring.h"
|
2006-08-13 22:54:59 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
2003-09-07 01:45:40 +00:00
|
|
|
|
2007-09-01 04:01:13 +00:00
|
|
|
class Buffer;
|
2003-09-07 01:45:40 +00:00
|
|
|
class BufferView;
|
2008-02-28 01:42:02 +00:00
|
|
|
class DocumentClass;
|
2003-09-07 01:45:40 +00:00
|
|
|
class FuncRequest;
|
2003-09-04 03:54:04 +00:00
|
|
|
class FuncStatus;
|
2007-04-27 08:43:38 +00:00
|
|
|
class KeySymbol;
|
2007-04-29 23:33:02 +00:00
|
|
|
class Text;
|
2001-04-17 15:15:59 +00:00
|
|
|
|
2007-11-19 12:03:38 +00:00
|
|
|
namespace support {
|
|
|
|
class FileName;
|
|
|
|
}
|
|
|
|
|
2007-08-14 09:54:59 +00:00
|
|
|
namespace frontend {
|
|
|
|
class LyXView;
|
|
|
|
}
|
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.
|
|
|
|
*/
|
2007-10-11 07:26:06 +00:00
|
|
|
class LyXFunc
|
|
|
|
{
|
1999-09-27 18:44:28 +00:00
|
|
|
public:
|
|
|
|
///
|
2006-10-19 07:20:32 +00:00
|
|
|
explicit LyXFunc();
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-06-12 11:27:15 +00:00
|
|
|
/// LyX dispatcher, executes lyx actions.
|
2004-11-08 10:54:29 +00:00
|
|
|
void dispatch(FuncRequest const &);
|
2002-12-01 22:59:25 +00:00
|
|
|
|
2006-10-12 14:58:57 +00:00
|
|
|
///
|
2007-08-14 09:54:59 +00:00
|
|
|
void setLyXView(frontend::LyXView * lv);
|
2008-03-14 23:24:45 +00:00
|
|
|
|
2006-10-19 07:20:32 +00:00
|
|
|
///
|
2007-04-27 08:05:58 +00:00
|
|
|
void initKeySequences(KeyMap * kb);
|
2006-10-19 07:20:32 +00:00
|
|
|
|
2002-07-18 20:15:29 +00:00
|
|
|
/// return the status bar state string
|
2008-03-15 01:20:36 +00:00
|
|
|
docstring viewStatusMessage();
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2000-08-14 15:31:16 +00:00
|
|
|
///
|
2007-10-02 21:51:54 +00:00
|
|
|
void processKeySym(KeySymbol const & key, KeyModifier state);
|
2000-11-04 10:00:12 +00:00
|
|
|
|
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
|
2006-10-21 00:16:43 +00:00
|
|
|
void setMessage(docstring const & m) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
/// Buffer to store result messages
|
2006-10-21 00:16:43 +00:00
|
|
|
void setErrorMessage(docstring const &) const;
|
2002-03-21 17:27:08 +00:00
|
|
|
/// Buffer to store result messages
|
2006-10-21 00:16:43 +00:00
|
|
|
docstring const getMessage() const { return dispatch_buffer; }
|
2002-06-18 15:44:30 +00:00
|
|
|
/// Handle a accented char key sequence
|
2008-03-15 01:20:36 +00:00
|
|
|
void handleKeyFunc(FuncCode action);
|
2007-01-11 16:01:10 +00:00
|
|
|
/// goto a bookmark
|
|
|
|
/// openFile: whether or not open a file if the file is not opened
|
2007-05-28 22:27:45 +00:00
|
|
|
/// switchToBuffer: whether or not switch to buffer if the buffer is
|
2007-01-11 16:01:10 +00:00
|
|
|
/// not the current buffer
|
|
|
|
void gotoBookmark(unsigned int idx, bool openFile, bool switchToBuffer);
|
2002-01-12 20:00:47 +00:00
|
|
|
|
2007-12-17 18:13:02 +00:00
|
|
|
/// cursor x position before dispatch started
|
2008-03-15 01:20:36 +00:00
|
|
|
int cursorBeforeDispatchX() const { return cursorPosBeforeDispatchX_; }
|
2007-12-17 18:13:02 +00:00
|
|
|
/// cursor y position before dispatch started
|
2008-03-15 01:20:36 +00:00
|
|
|
int cursorBeforeDispatchY() const { return cursorPosBeforeDispatchY_; }
|
2007-12-17 18:13:02 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
private:
|
2002-08-13 17:43:40 +00:00
|
|
|
///
|
|
|
|
BufferView * view() const;
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2007-08-14 09:54:59 +00:00
|
|
|
frontend::LyXView * lyx_view_;
|
2003-01-05 22:38:42 +00:00
|
|
|
|
2007-01-24 14:01:34 +00:00
|
|
|
/// the last character added to the key sequence, in UCS4 encoded form
|
2006-10-21 00:16:43 +00:00
|
|
|
char_type encoded_last_key;
|
2003-01-05 22:38:42 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2007-09-17 22:51:03 +00:00
|
|
|
KeySequence keyseq;
|
2002-03-21 17:27:08 +00:00
|
|
|
///
|
2007-09-17 22:51:03 +00:00
|
|
|
KeySequence cancel_meta_seq;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2007-10-02 21:51:54 +00:00
|
|
|
KeyModifier meta_fake_bit;
|
2006-10-19 07:20:32 +00:00
|
|
|
|
2007-12-17 18:13:02 +00:00
|
|
|
/// cursor position before dispatch started
|
|
|
|
int cursorPosBeforeDispatchX_;
|
|
|
|
int cursorPosBeforeDispatchY_;
|
|
|
|
|
2002-03-21 17:27:08 +00:00
|
|
|
/// 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)
|
|
|
|
*/
|
2006-10-21 00:16:43 +00:00
|
|
|
mutable docstring dispatch_buffer;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2002-07-18 20:15:29 +00:00
|
|
|
/// send a post-dispatch status message
|
2006-10-21 00:16:43 +00:00
|
|
|
void sendDispatchMessage(docstring const & msg,
|
2004-11-08 10:54:29 +00:00
|
|
|
FuncRequest const & ev);
|
2002-07-18 20:15:29 +00:00
|
|
|
|
2006-09-17 10:51:59 +00:00
|
|
|
///
|
2007-01-17 14:46:20 +00:00
|
|
|
void reloadBuffer();
|
|
|
|
///
|
2006-09-17 10:51:59 +00:00
|
|
|
bool ensureBufferClean(BufferView * bv);
|
2007-09-01 04:01:13 +00:00
|
|
|
///
|
2008-05-22 14:02:35 +00:00
|
|
|
void updateLayout(DocumentClass const * const oldlayout, Buffer * buffer);
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
2002-03-21 17:27:08 +00:00
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
/// Implementation is in LyX.cpp
|
2006-10-11 17:24:46 +00:00
|
|
|
extern LyXFunc & theLyXFunc();
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
/// Implementation is in LyX.cpp
|
2006-10-11 17:24:46 +00:00
|
|
|
extern FuncStatus getStatus(FuncRequest const & action);
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
/// Implementation is in LyX.cpp
|
2006-10-11 17:24:46 +00:00
|
|
|
extern void dispatch(FuncRequest const & action);
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
2006-10-11 17:24:46 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|