]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
df5292b32a22c91aafb7a25f6c0466686e6638e0
[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/mouse_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 #ifdef __GNUG__
24 #pragma interface
25 #endif
26
27 class LyXView;
28 class WorkArea;
29 class LyXScreen;
30
31 ///
32 struct BufferView::Pimpl : public boost::signals::trackable {
33         ///
34         Pimpl(BufferView * i, LyXView * o,
35               int xpos, int ypos, int width, int height);
36         ///
37         Painter & painter() const;
38         /// return the work area for this bview
39         WorkArea & workarea() const;
40         /// return the screen for this bview
41         LyXScreen & screen() const;
42         ///
43         void buffer(Buffer *);
44         /// Return true if the cursor was fitted.
45         bool fitCursor();
46         ///
47         void redoCurrentBuffer();
48         ///
49         int resizeCurrentBuffer();
50         ///
51         void update();
52         //
53         void update(LyXText *, BufferView::UpdateCodes);
54         /**
55          * Repaint pixmap. Used for when we've made a visible
56          * change but don't need the full update() logic
57          */
58         void repaint();
59         ///
60         void workAreaResize();
61         ///
62         void updateScrollbar();
63         ///
64         void scrollDocView(int value);
65         /**
66          * Returns an inset if inset was hit, or 0 if not.
67          *
68          * If hit, the coordinates are changed relative to the inset.
69          */
70         Inset * checkInsetHit(LyXText *, int & x, int & y);
71         /// wheel mouse scroll
72         int scroll(long time);
73         ///
74         void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
75         ///
76         void workAreaMotionNotify(int x, int y, mouse_button::state state);
77         ///
78         void workAreaButtonPress(int x, int y, mouse_button::state button);
79         ///
80         void workAreaButtonRelease(int x, int y, mouse_button::state button);
81         ///
82         void doubleClick(int x, int y, mouse_button::state button);
83         ///
84         void tripleClick(int x, int y, mouse_button::state button);
85         ///
86         void selectionRequested();
87         ///
88         void selectionLost();
89         ///
90         void cursorToggle();
91         ///
92         bool available() const;
93         ///
94         void beforeChange(LyXText *);
95         ///
96         void savePosition(unsigned int i);
97         ///
98         void restorePosition(unsigned int i);
99         ///
100         bool isSavedPosition(unsigned int i);
101         ///
102         void switchKeyMap();
103         ///
104         void insetUnlock();
105         ///
106         void showCursor();
107         ///
108         void hideCursor();
109         ///
110         void toggleSelection(bool = true);
111         ///
112         void toggleToggle();
113         ///
114         void center();
115         ///
116         bool insertInset(Inset * inset, string const & lout = string());
117         ///
118         void updateInset(Inset * inset, bool mark_dirty);
119         ///
120         bool dispatch(FuncRequest const & ev);
121 private:
122         ///
123         friend class BufferView;
124
125         ///
126         BufferView * bv_;
127         ///
128         LyXView * owner_;
129         ///
130         Buffer * buffer_;
131         ///
132         boost::scoped_ptr<LyXScreen> screen_;
133         ///
134         boost::scoped_ptr<WorkArea> workarea_;
135         ///
136         Timeout cursor_timeout;
137         ///
138         void stuffClipboard(string const &) const;
139         ///
140         bool using_xterm_cursor;
141         ///
142         struct Position {
143                 /// Filename
144                 string filename;
145                 /// Cursor paragraph Id
146                 int par_id;
147                 /// Cursor position
148                 lyx::pos_type par_pos;
149                 ///
150                 Position() : par_id(0), par_pos(0) {}
151                 ///
152                 Position(string const & f, int id, lyx::pos_type pos)
153                         : filename(f), par_id(id), par_pos(pos) {}
154         };
155         ///
156         std::vector<Position> saved_positions;
157         /// Get next inset of this class from current cursor position
158         Inset * getInsetByCode(Inset::Code code);
159         ///
160         void MenuInsertLyXFile(string const & filen);
161 };
162 #endif // BUFFERVIEW_PIMPL_H