2000-04-08 17:02:02 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-06-12 02:54:19 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file BufferView_pimpl.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.
|
2002-06-12 02:54:19 +00:00
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Asger Alstrup
|
|
|
|
|
* \author Alfredo Braustein
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
* \author John Levon
|
|
|
|
|
* \author Andr<EFBFBD> P<EFBFBD>nitz
|
|
|
|
|
* \author Dekel Tsur
|
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
|
|
|
|
*
|
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-06-12 02:54:19 +00:00
|
|
|
|
*/
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
|
|
|
|
#ifndef BUFFERVIEW_PIMPL_H
|
|
|
|
|
#define BUFFERVIEW_PIMPL_H
|
|
|
|
|
|
|
|
|
|
#include "BufferView.h"
|
2003-11-04 12:36:59 +00:00
|
|
|
|
#include "cursor.h"
|
2003-09-06 20:08:10 +00:00
|
|
|
|
#include "errorlist.h"
|
2003-09-06 19:16:30 +00:00
|
|
|
|
|
|
|
|
|
#include "insets/inset.h"
|
|
|
|
|
|
2002-06-12 02:54:19 +00:00
|
|
|
|
#include "frontends/key_state.h"
|
2003-09-06 19:16:30 +00:00
|
|
|
|
#include "frontends/Timeout.h"
|
|
|
|
|
|
2001-11-26 16:42:04 +00:00
|
|
|
|
#include "support/types.h"
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
2002-05-22 01:16:37 +00:00
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2003-09-06 20:08:10 +00:00
|
|
|
|
#include <boost/shared_ptr.hpp>
|
2002-05-29 16:21:03 +00:00
|
|
|
|
#include <boost/signals/trackable.hpp>
|
2002-05-22 01:16:37 +00:00
|
|
|
|
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
|
class Change;
|
2003-09-06 20:08:10 +00:00
|
|
|
|
class LyXKeySym;
|
2000-04-08 17:02:02 +00:00
|
|
|
|
class LyXView;
|
|
|
|
|
class WorkArea;
|
2002-06-18 15:44:30 +00:00
|
|
|
|
class LyXScreen;
|
2002-08-28 08:30:27 +00:00
|
|
|
|
class FuncRequest;
|
2004-04-01 08:58:45 +00:00
|
|
|
|
class FuncStatus;
|
2004-11-30 01:59:49 +00:00
|
|
|
|
class ViewMetricsInfo;
|
2002-07-28 18:13:51 +00:00
|
|
|
|
|
2004-01-13 14:13:51 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class BufferView::Pimpl : public boost::signals::trackable {
|
|
|
|
|
public:
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2004-04-28 17:22:05 +00:00
|
|
|
|
Pimpl(BufferView & bv, LyXView * owner, int width, int height);
|
2000-04-09 22:48:51 +00:00
|
|
|
|
///
|
2002-06-12 02:54:19 +00:00
|
|
|
|
Painter & painter() const;
|
2002-06-11 23:47:58 +00:00
|
|
|
|
/// return the screen for this bview
|
2002-06-18 15:44:30 +00:00
|
|
|
|
LyXScreen & screen() const;
|
2000-04-09 22:48:51 +00:00
|
|
|
|
///
|
2004-03-18 12:53:43 +00:00
|
|
|
|
void setBuffer(Buffer * buf);
|
2000-04-09 22:48:51 +00:00
|
|
|
|
///
|
2003-08-11 09:09:01 +00:00
|
|
|
|
void resizeCurrentBuffer();
|
2005-01-12 10:30:46 +00:00
|
|
|
|
//
|
2004-11-30 01:59:49 +00:00
|
|
|
|
bool fitCursor();
|
2000-04-09 22:48:51 +00:00
|
|
|
|
///
|
2004-11-30 01:59:49 +00:00
|
|
|
|
void update(bool fitcursor = false, bool forceupdate = true);
|
2003-06-20 12:46:28 +00:00
|
|
|
|
///
|
2004-03-18 12:53:43 +00:00
|
|
|
|
void newFile(std::string const &, std::string const &, bool);
|
2003-07-07 08:37:02 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
bool loadLyXFile(std::string const &, bool);
|
2003-06-20 12:46:28 +00:00
|
|
|
|
///
|
2002-06-20 20:37:42 +00:00
|
|
|
|
void workAreaResize();
|
2000-04-08 17:02:02 +00:00
|
|
|
|
///
|
2000-04-09 22:48:51 +00:00
|
|
|
|
void updateScrollbar();
|
|
|
|
|
///
|
2002-06-12 15:01:32 +00:00
|
|
|
|
void scrollDocView(int value);
|
2004-01-16 10:55:19 +00:00
|
|
|
|
/// Wheel mouse scroll, move by multiples of text->defaultRowHeight().
|
2002-10-21 00:15:48 +00:00
|
|
|
|
void scroll(int lines);
|
2002-03-21 17:27:08 +00:00
|
|
|
|
///
|
2003-09-06 20:08:10 +00:00
|
|
|
|
typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
|
|
|
|
|
///
|
2002-08-27 16:16:17 +00:00
|
|
|
|
void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
|
2000-08-14 15:31:16 +00:00
|
|
|
|
///
|
2002-01-13 17:28:42 +00:00
|
|
|
|
void selectionRequested();
|
|
|
|
|
///
|
2002-02-07 16:43:54 +00:00
|
|
|
|
void selectionLost();
|
|
|
|
|
///
|
2000-04-09 22:48:51 +00:00
|
|
|
|
void cursorToggle();
|
|
|
|
|
///
|
|
|
|
|
bool available() const;
|
2003-02-08 19:18:01 +00:00
|
|
|
|
/// get the change at the cursor position
|
|
|
|
|
Change const getCurrentChange();
|
2000-04-09 22:48:51 +00:00
|
|
|
|
///
|
2001-01-28 18:31:36 +00:00
|
|
|
|
void savePosition(unsigned int i);
|
2000-04-09 22:48:51 +00:00
|
|
|
|
///
|
2001-01-28 18:31:36 +00:00
|
|
|
|
void restorePosition(unsigned int i);
|
2000-04-09 22:48:51 +00:00
|
|
|
|
///
|
2001-01-28 18:31:36 +00:00
|
|
|
|
bool isSavedPosition(unsigned int i);
|
2000-06-05 15:12:09 +00:00
|
|
|
|
///
|
2002-07-17 04:13:41 +00:00
|
|
|
|
void switchKeyMap();
|
2000-04-09 22:48:51 +00:00
|
|
|
|
///
|
|
|
|
|
void center();
|
2003-03-24 02:31:44 +00:00
|
|
|
|
/// a function should be executed from the workarea
|
|
|
|
|
bool workAreaDispatch(FuncRequest const & ev);
|
2004-04-01 08:58:45 +00:00
|
|
|
|
/// return true for events that will handle
|
|
|
|
|
FuncStatus getStatus(FuncRequest const & cmd);
|
2003-03-24 02:31:44 +00:00
|
|
|
|
/// a function should be executed
|
2002-08-07 08:11:41 +00:00
|
|
|
|
bool dispatch(FuncRequest const & ev);
|
2001-03-06 19:29:58 +00:00
|
|
|
|
private:
|
2003-05-20 16:51:31 +00:00
|
|
|
|
/// An error list (replaces the error insets)
|
|
|
|
|
ErrorList errorlist_;
|
2003-06-20 23:03:43 +00:00
|
|
|
|
/// add an error to the list
|
|
|
|
|
void addError(ErrorItem const &);
|
2003-07-07 08:37:02 +00:00
|
|
|
|
/// buffer errors signal connection
|
|
|
|
|
boost::signals::connection errorConnection_;
|
|
|
|
|
/// buffer messages signal connection
|
|
|
|
|
boost::signals::connection messageConnection_;
|
|
|
|
|
/// buffer busy status signal connection
|
|
|
|
|
boost::signals::connection busyConnection_;
|
2003-07-10 12:26:40 +00:00
|
|
|
|
/// buffer title changed signal connection
|
|
|
|
|
boost::signals::connection titleConnection_;
|
|
|
|
|
/// buffer reset timers signal connection
|
|
|
|
|
boost::signals::connection timerConnection_;
|
|
|
|
|
/// buffer readonly status changed signal connection
|
|
|
|
|
boost::signals::connection readonlyConnection_;
|
2003-07-11 12:21:31 +00:00
|
|
|
|
/// buffer closing signal connection
|
|
|
|
|
boost::signals::connection closingConnection_;
|
2003-07-07 08:37:02 +00:00
|
|
|
|
/// connect to signals in the given buffer
|
|
|
|
|
void connectBuffer(Buffer & buf);
|
|
|
|
|
/// disconnect from signals in the given buffer
|
|
|
|
|
void disconnectBuffer();
|
2003-02-08 19:18:01 +00:00
|
|
|
|
/// track changes for the document
|
|
|
|
|
void trackChanges();
|
2003-07-10 12:26:40 +00:00
|
|
|
|
/// notify readonly status
|
|
|
|
|
void showReadonly(bool);
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
2003-09-06 19:16:30 +00:00
|
|
|
|
|
2001-03-06 19:29:58 +00:00
|
|
|
|
///
|
|
|
|
|
friend class BufferView;
|
2002-08-27 12:32:04 +00:00
|
|
|
|
|
2001-06-04 23:57:32 +00:00
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
|
BufferView * bv_;
|
|
|
|
|
///
|
|
|
|
|
LyXView * owner_;
|
|
|
|
|
///
|
|
|
|
|
Buffer * buffer_;
|
|
|
|
|
///
|
2002-06-18 15:44:30 +00:00
|
|
|
|
boost::scoped_ptr<LyXScreen> screen_;
|
2000-04-08 17:02:02 +00:00
|
|
|
|
///
|
2002-06-11 22:38:49 +00:00
|
|
|
|
boost::scoped_ptr<WorkArea> workarea_;
|
|
|
|
|
///
|
2000-06-08 23:16:16 +00:00
|
|
|
|
Timeout cursor_timeout;
|
2000-04-08 17:02:02 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void stuffClipboard(std::string const &) const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2000-04-14 19:20:33 +00:00
|
|
|
|
bool using_xterm_cursor;
|
2001-03-06 19:29:58 +00:00
|
|
|
|
///
|
2005-01-19 15:03:31 +00:00
|
|
|
|
class Position {
|
|
|
|
|
public:
|
2001-01-28 18:31:36 +00:00
|
|
|
|
/// Filename
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string filename;
|
2001-11-26 16:42:04 +00:00
|
|
|
|
/// Cursor paragraph Id
|
|
|
|
|
int par_id;
|
|
|
|
|
/// Cursor position
|
2001-11-27 10:34:16 +00:00
|
|
|
|
lyx::pos_type par_pos;
|
2001-01-28 18:31:36 +00:00
|
|
|
|
///
|
|
|
|
|
Position() : par_id(0), par_pos(0) {}
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
Position(std::string const & f, int id, lyx::pos_type pos)
|
2001-11-26 16:42:04 +00:00
|
|
|
|
: filename(f), par_id(id), par_pos(pos) {}
|
2001-01-28 18:31:36 +00:00
|
|
|
|
};
|
2001-03-06 19:29:58 +00:00
|
|
|
|
///
|
2001-01-28 18:33:17 +00:00
|
|
|
|
std::vector<Position> saved_positions;
|
2001-03-06 19:29:58 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void MenuInsertLyXFile(std::string const & filen);
|
2002-08-29 13:41:58 +00:00
|
|
|
|
/// our workarea
|
2002-09-03 11:54:41 +00:00
|
|
|
|
WorkArea & workarea() const;
|
2003-12-12 15:19:35 +00:00
|
|
|
|
/// this is used to handle XSelection events in the right manner
|
|
|
|
|
struct {
|
2004-01-13 14:13:51 +00:00
|
|
|
|
CursorSlice cursor;
|
|
|
|
|
CursorSlice anchor;
|
2003-12-12 15:19:35 +00:00
|
|
|
|
bool set;
|
|
|
|
|
} xsel_cache_;
|
2003-11-04 12:36:59 +00:00
|
|
|
|
///
|
|
|
|
|
LCursor cursor_;
|
2004-11-30 01:59:49 +00:00
|
|
|
|
///
|
|
|
|
|
///
|
|
|
|
|
lyx::pit_type anchor_ref_;
|
|
|
|
|
///
|
|
|
|
|
int offset_ref_;
|
|
|
|
|
///
|
|
|
|
|
ViewMetricsInfo metrics();
|
|
|
|
|
|
|
|
|
|
|
2000-04-08 17:02:02 +00:00
|
|
|
|
};
|
2002-06-12 15:01:32 +00:00
|
|
|
|
#endif // BUFFERVIEW_PIMPL_H
|