]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
761d1911dcc66306ebe973eaf8eb5bc2efabf190
[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         /// a function should be executed from the workarea
106         bool workAreaDispatch(FuncRequest const & ev);
107         /// a function should be executed
108         bool dispatch(FuncRequest const & ev);
109 private:
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