Move private part of BufferView to a private implementation.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20896 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-10-11 09:59:01 +00:00
parent a2bc74bca8
commit 9a458ec6e9
14 changed files with 305 additions and 253 deletions

File diff suppressed because it is too large Load Diff

View File

@ -15,12 +15,10 @@
#ifndef BUFFER_VIEW_H #ifndef BUFFER_VIEW_H
#define BUFFER_VIEW_H #define BUFFER_VIEW_H
#include "CoordCache.h" #include "Dimension.h"
#include "Cursor.h"
#include "MetricsInfo.h"
#include "TextMetrics.h"
#include "update_flags.h" #include "update_flags.h"
#include "support/docstring.h"
#include "support/types.h" #include "support/types.h"
#include <boost/noncopyable.hpp> #include <boost/noncopyable.hpp>
@ -38,14 +36,17 @@ namespace frontend { class GuiBufferViewDelegate; }
class Buffer; class Buffer;
class Change; class Change;
class CoordCache;
class Cursor;
class DocIterator; class DocIterator;
class FuncRequest; class FuncRequest;
class FuncStatus; class FuncStatus;
class Intl; class Intl;
class Cursor; class Inset;
class Text;
class ParIterator; class ParIterator;
class ParagraphMetrics; class ParagraphMetrics;
class Text;
class TextMetrics;
class ViewMetricsInfo; class ViewMetricsInfo;
enum CursorStatus { enum CursorStatus {
@ -216,9 +217,9 @@ public:
ParagraphMetrics const & parMetrics(Text const *, pit_type) const; ParagraphMetrics const & parMetrics(Text const *, pit_type) const;
/// ///
CoordCache & coordCache() { return coord_cache_; } CoordCache & coordCache();
/// ///
CoordCache const & coordCache() const { return coord_cache_; } CoordCache const & coordCache() const;
/// ///
Point getPos(DocIterator const & dit, bool boundary) const; Point getPos(DocIterator const & dit, bool boundary) const;
@ -228,9 +229,9 @@ public:
void draw(frontend::Painter & pain); void draw(frontend::Painter & pain);
/// get this view's keyboard map handler. /// get this view's keyboard map handler.
Intl & getIntl() { return *intl_.get(); } Intl & getIntl();
/// ///
Intl const & getIntl() const { return *intl_.get(); } Intl const & getIntl() const;
// //
// Messages to the GUI // Messages to the GUI
@ -259,6 +260,7 @@ public:
docstring contentsOfPlaintextFile(std::string const & f, bool asParagraph); docstring contentsOfPlaintextFile(std::string const & f, bool asParagraph);
// Insert plain text file (if filename is empty, prompt for one) // Insert plain text file (if filename is empty, prompt for one)
void insertPlaintextFile(std::string const & fileName, bool asParagraph); void insertPlaintextFile(std::string const & fileName, bool asParagraph);
private: private:
// the position relative to (0, baseline) of outermost paragraph // the position relative to (0, baseline) of outermost paragraph
Point coordOffset(DocIterator const & dit, bool boundary) const; Point coordOffset(DocIterator const & dit, bool boundary) const;
@ -281,51 +283,15 @@ private:
/// ///
int height_; int height_;
/// ///
ScrollbarParameters scrollbarParameters_;
///
ViewMetricsInfo metrics_info_;
///
CoordCache coord_cache_;
///
Buffer & buffer_; Buffer & buffer_;
/// Estimated average par height for scrollbar.
int wh_;
/// ///
void menuInsertLyXFile(std::string const & filen); void menuInsertLyXFile(std::string const & filen);
/// this is used to handle XSelection events in the right manner.
struct {
CursorSlice cursor;
CursorSlice anchor;
bool set;
} xsel_cache_;
///
Cursor cursor_;
///
bool multiparsel_cache_;
///
pit_type anchor_ref_;
///
int offset_ref_;
///
void updateOffsetRef(); void updateOffsetRef();
///
bool need_centering_;
/// keyboard mapping object. struct BufferViewPrivate;
boost::scoped_ptr<Intl> const intl_; BufferViewPrivate & d;
/// last visited inset (kept to send setMouseHover(false) )
Inset * last_inset_;
/// A map from a Text to the associated text metrics
typedef std::map<Text const *, TextMetrics> TextMetricsCache;
mutable TextMetricsCache text_metrics_;
// Whom to notify. Not owned, so don't delete.
frontend::GuiBufferViewDelegate * gui_;
}; };
/// some space for drawing the 'nested' markers (in pixel) /// some space for drawing the 'nested' markers (in pixel)

View File

@ -29,18 +29,6 @@ class Paragraph;
void lyxbreaker(void const * data, const char * hint, int size); void lyxbreaker(void const * data, const char * hint, int size);
class Point {
public:
Point()
: x_(0), y_(0)
{}
Point(int x, int y);
int x_, y_;
};
struct Geometry { struct Geometry {
Point pos; Point pos;
Dimension dim; Dimension dim;

View File

@ -33,6 +33,7 @@
#include "Paragraph.h" #include "Paragraph.h"
#include "paragraph_funcs.h" #include "paragraph_funcs.h"
#include "ParIterator.h" #include "ParIterator.h"
#include "TextMetrics.h"
#include "insets/InsetTabular.h" #include "insets/InsetTabular.h"
#include "insets/InsetText.h" #include "insets/InsetText.h"

View File

@ -77,6 +77,16 @@ bool operator!=(Dimension const & a, Dimension const & b)
return a.wid != b.wid || a.asc != b.asc || a.des != b.des ; return a.wid != b.wid || a.asc != b.asc || a.des != b.des ;
} }
class Point {
public:
Point()
: x_(0), y_(0)
{}
Point(int x, int y);
int x_, y_;
};
} // namespace lyx } // namespace lyx

View File

@ -45,6 +45,7 @@
#include "paragraph_funcs.h" #include "paragraph_funcs.h"
#include "ParagraphParameters.h" #include "ParagraphParameters.h"
#include "Undo.h" #include "Undo.h"
#include "TextMetrics.h"
#include "VSpace.h" #include "VSpace.h"
#include "WordLangTuple.h" #include "WordLangTuple.h"

View File

@ -47,6 +47,7 @@
#include "ParIterator.h" #include "ParIterator.h"
#include "Server.h" #include "Server.h"
#include "ServerSocket.h" #include "ServerSocket.h"
#include "TextMetrics.h"
#include "Undo.h" #include "Undo.h"
#include "VSpace.h" #include "VSpace.h"

View File

@ -43,6 +43,7 @@
#include "Paragraph.h" #include "Paragraph.h"
#include "paragraph_funcs.h" #include "paragraph_funcs.h"
#include "ParagraphParameters.h" #include "ParagraphParameters.h"
#include "TextMetrics.h"
#include "Undo.h" #include "Undo.h"
#include "VSpace.h" #include "VSpace.h"
#include "ParIterator.h" #include "ParIterator.h"

View File

@ -17,6 +17,7 @@
#include "gettext.h" #include "gettext.h"
#include "lengthcommon.h" #include "lengthcommon.h"
#include "Text.h" #include "Text.h"
#include "TextMetrics.h" // for defaultRowHeight()
#include "support/convert.h" #include "support/convert.h"
#include "support/lstrings.h" #include "support/lstrings.h"

View File

@ -37,6 +37,7 @@
#include "BufferParams.h" #include "BufferParams.h"
#include "BufferView.h" #include "BufferView.h"
#include "BufferList.h" #include "BufferList.h"
#include "Cursor.h"
#include "debug.h" #include "debug.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "Layout.h" #include "Layout.h"

View File

@ -23,6 +23,7 @@
#include "Buffer.h" #include "Buffer.h"
#include "BufferView.h" #include "BufferView.h"
#include "Color.h" #include "Color.h"
#include "Cursor.h"
#include "debug.h" #include "debug.h"
#include "FuncRequest.h" #include "FuncRequest.h"
#include "LyXFunc.h" #include "LyXFunc.h"

View File

@ -43,6 +43,7 @@
#include "Paragraph.h" #include "Paragraph.h"
#include "ParagraphParameters.h" #include "ParagraphParameters.h"
#include "ParIterator.h" #include "ParIterator.h"
#include "TextMetrics.h"
#include "Undo.h" #include "Undo.h"
#include "support/convert.h" #include "support/convert.h"

View File

@ -42,6 +42,7 @@
#include "ParIterator.h" #include "ParIterator.h"
#include "Row.h" #include "Row.h"
#include "sgml.h" #include "sgml.h"
#include "TextMetrics.h"
#include "TexRow.h" #include "TexRow.h"
#include "Undo.h" #include "Undo.h"

View File

@ -19,11 +19,12 @@
#include "MathSupport.h" #include "MathSupport.h"
#include "ReplaceData.h" #include "ReplaceData.h"
#include "BufferView.h"
#include "Buffer.h" #include "Buffer.h"
#include "BufferView.h"
#include "CoordCache.h"
#include "Color.h"
#include "Cursor.h" #include "Cursor.h"
#include "debug.h" #include "debug.h"
#include "Color.h"
#include "frontends/FontMetrics.h" #include "frontends/FontMetrics.h"
#include "frontends/Painter.h" #include "frontends/Painter.h"