]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
"Inter-word Space"
[lyx.git] / src / BufferView_pimpl.h
1 // -*- C++ -*-
2 /**
3  * \file BufferView_pimpl.h
4  * Copyright 2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author various
8  */
9
10 #ifndef BUFFERVIEW_PIMPL_H
11 #define BUFFERVIEW_PIMPL_H
12
13 #include "errorlist.h"
14 #include "BufferView.h"
15 #include "frontends/Timeout.h"
16 #include "frontends/key_state.h"
17 #include "frontends/LyXKeySym.h"
18 #include "support/types.h"
19
20 #include <boost/scoped_ptr.hpp>
21 #include <boost/signals/trackable.hpp>
22
23
24 class Change;
25 class LyXView;
26 class WorkArea;
27 class LyXScreen;
28 class FuncRequest;
29
30 ///
31 struct BufferView::Pimpl : public boost::signals::trackable {
32         ///
33         Pimpl(BufferView * i, LyXView * o,
34               int xpos, int ypos, int width, int height);
35         ///
36         Painter & painter() const;
37         /// return the screen for this bview
38         LyXScreen & screen() const;
39         ///
40         void buffer(Buffer *);
41         /// Return true if the cursor was fitted.
42         bool fitCursor();
43         ///
44         void redoCurrentBuffer();
45         ///
46         int resizeCurrentBuffer();
47         ///
48         void update();
49         //
50         void update(LyXText *, BufferView::UpdateCodes);
51         /// update the toplevel lyx text
52         void update(BufferView::UpdateCodes);
53         /**
54          * Repaint pixmap. Used for when we've made a visible
55          * change but don't need the full update() logic
56          */
57         void repaint();
58         ///
59         void workAreaResize();
60         ///
61         void updateScrollbar();
62         ///
63         void scrollDocView(int value);
64         /**
65          * Wheel mouse scroll, move by multiples of text->defaultRowHeight().
66          */
67         void scroll(int lines);
68         ///
69         void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
70         ///
71         void selectionRequested();
72         ///
73         void selectionLost();
74         ///
75         void cursorToggle();
76         ///
77         bool available() const;
78         /// get the change at the cursor position
79         Change const getCurrentChange();
80         ///
81         void beforeChange(LyXText *);
82         ///
83         void savePosition(unsigned int i);
84         ///
85         void restorePosition(unsigned int i);
86         ///
87         bool isSavedPosition(unsigned int i);
88         ///
89         void switchKeyMap();
90         ///
91         void insetUnlock();
92         ///
93         void toggleSelection(bool = true);
94         ///
95         void toggleToggle();
96         ///
97         void center();
98         ///
99         bool insertInset(Inset * inset, string const & lout = string());
100         ///
101         void updateInset(Inset * inset);
102         /// a function should be executed from the workarea
103         bool workAreaDispatch(FuncRequest const & ev);
104         /// a function should be executed
105         bool dispatch(FuncRequest const & ev);
106 private:
107         /// An error list (replaces the error insets)
108         ErrorList errorlist_;
109
110         /// track changes for the document
111         void trackChanges();
112
113         ///
114         friend class BufferView;
115
116         ///
117         BufferView * bv_;
118         ///
119         LyXView * owner_;
120         ///
121         Buffer * buffer_;
122         ///
123         boost::scoped_ptr<LyXScreen> screen_;
124         ///
125         boost::scoped_ptr<WorkArea> workarea_;
126         ///
127         Timeout cursor_timeout;
128         ///
129         void stuffClipboard(string const &) const;
130         ///
131         bool using_xterm_cursor;
132         ///
133         struct Position {
134                 /// Filename
135                 string filename;
136                 /// Cursor paragraph Id
137                 int par_id;
138                 /// Cursor position
139                 lyx::pos_type par_pos;
140                 ///
141                 Position() : par_id(0), par_pos(0) {}
142                 ///
143                 Position(string const & f, int id, lyx::pos_type pos)
144                         : filename(f), par_id(id), par_pos(pos) {}
145         };
146         ///
147         std::vector<Position> saved_positions;
148         /// Get next inset of this class from current cursor position
149         Inset * getInsetByCode(Inset::Code code);
150         ///
151         void MenuInsertLyXFile(string const & filen);
152         /// our workarea
153         WorkArea & workarea() const;
154 };
155 #endif // BUFFERVIEW_PIMPL_H