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