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