]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
another safety belt
[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 screen for this bview
39         LyXScreen & screen() const;
40         ///
41         void buffer(Buffer *);
42         /// Return true if the cursor was fitted.
43         bool fitCursor();
44         ///
45         void redoCurrentBuffer();
46         ///
47         int resizeCurrentBuffer();
48         ///
49         void update();
50         //
51         void update(LyXText *, 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->defaultHeight().
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         ///
78         void beforeChange(LyXText *);
79         ///
80         void savePosition(unsigned int i);
81         ///
82         void restorePosition(unsigned int i);
83         ///
84         bool isSavedPosition(unsigned int i);
85         ///
86         void switchKeyMap();
87         ///
88         void insetUnlock();
89         ///
90         void showCursor();
91         ///
92         void hideCursor();
93         ///
94         void toggleSelection(bool = true);
95         ///
96         void toggleToggle();
97         ///
98         void center();
99         ///
100         bool insertInset(Inset * inset, string const & lout = string());
101         ///
102         void updateInset(Inset * inset, bool mark_dirty);
103         ///
104         bool dispatch(FuncRequest const & ev);
105 private:
106         ///
107         friend class BufferView;
108
109         ///
110         BufferView * bv_;
111         ///
112         LyXView * owner_;
113         ///
114         Buffer * buffer_;
115         ///
116         boost::scoped_ptr<LyXScreen> screen_;
117         ///
118         boost::scoped_ptr<WorkArea> workarea_;
119         ///
120         Timeout cursor_timeout;
121         ///
122         void stuffClipboard(string const &) const;
123         ///
124         bool using_xterm_cursor;
125         ///
126         struct Position {
127                 /// Filename
128                 string filename;
129                 /// Cursor paragraph Id
130                 int par_id;
131                 /// Cursor position
132                 lyx::pos_type par_pos;
133                 ///
134                 Position() : par_id(0), par_pos(0) {}
135                 ///
136                 Position(string const & f, int id, lyx::pos_type pos)
137                         : filename(f), par_id(id), par_pos(pos) {}
138         };
139         ///
140         std::vector<Position> saved_positions;
141         /// Get next inset of this class from current cursor position
142         Inset * getInsetByCode(Inset::Code code);
143         ///
144         void MenuInsertLyXFile(string const & filen);
145         /// our workarea
146         WorkArea & workarea() const;
147 };
148 #endif // BUFFERVIEW_PIMPL_H