]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
b1832f9b3603001d605e30f2a879cb35b67f05bf
[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 #ifdef __GNUG__
23 #pragma interface
24 #endif
25
26 class LyXView;
27 class WorkArea;
28 class LyXScreen;
29 class FuncRequest;
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 selectionRequested();
77         ///
78         void selectionLost();
79         ///
80         void cursorToggle();
81         ///
82         bool available() const;
83         ///
84         void beforeChange(LyXText *);
85         ///
86         void savePosition(unsigned int i);
87         ///
88         void restorePosition(unsigned int i);
89         ///
90         bool isSavedPosition(unsigned int i);
91         ///
92         void switchKeyMap();
93         ///
94         void insetUnlock();
95         ///
96         void showCursor();
97         ///
98         void hideCursor();
99         ///
100         void toggleSelection(bool = true);
101         ///
102         void toggleToggle();
103         ///
104         void center();
105         ///
106         bool insertInset(Inset * inset, string const & lout = string());
107         ///
108         void updateInset(Inset * inset, bool mark_dirty);
109         ///
110         bool dispatch(FuncRequest const & ev);
111 private:
112         ///
113         friend class BufferView;
114
115         ///
116         BufferView * bv_;
117         ///
118         LyXView * owner_;
119         ///
120         Buffer * buffer_;
121         ///
122         boost::scoped_ptr<LyXScreen> screen_;
123         ///
124         boost::scoped_ptr<WorkArea> workarea_;
125         ///
126         Timeout cursor_timeout;
127         ///
128         void stuffClipboard(string const &) const;
129         ///
130         bool using_xterm_cursor;
131         ///
132         struct Position {
133                 /// Filename
134                 string filename;
135                 /// Cursor paragraph Id
136                 int par_id;
137                 /// Cursor position
138                 lyx::pos_type par_pos;
139                 ///
140                 Position() : par_id(0), par_pos(0) {}
141                 ///
142                 Position(string const & f, int id, lyx::pos_type pos)
143                         : filename(f), par_id(id), par_pos(pos) {}
144         };
145         ///
146         std::vector<Position> saved_positions;
147         /// Get next inset of this class from current cursor position
148         Inset * getInsetByCode(Inset::Code code);
149         ///
150         void MenuInsertLyXFile(string const & filen);
151 };
152 #endif // BUFFERVIEW_PIMPL_H