]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
clean up a bit
[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 Change;
27 class LyXView;
28 class WorkArea;
29 class LyXScreen;
30 class FuncRequest;
31
32 ///
33 struct BufferView::Pimpl : public boost::signals::trackable {
34         ///
35         Pimpl(BufferView * i, LyXView * o,
36               int xpos, int ypos, int width, int height);
37         ///
38         Painter & painter() const;
39         /// return the screen for this bview
40         LyXScreen & screen() const;
41         ///
42         void buffer(Buffer *);
43         /// Return true if the cursor was fitted.
44         bool fitCursor();
45         ///
46         void redoCurrentBuffer();
47         ///
48         int resizeCurrentBuffer();
49         ///
50         void update();
51         //
52         void update(LyXText *, BufferView::UpdateCodes);
53         /**
54          * Repaint pixmap. Used for when we've made a visible
55          * change but don't need the full update() logic
56          */
57         void repaint();
58         ///
59         void workAreaResize();
60         ///
61         void updateScrollbar();
62         ///
63         void scrollDocView(int value);
64         /**
65          * Wheel mouse scroll, move by multiples of text->defaultHeight().
66          */
67         void scroll(int lines);
68         ///
69         void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
70         ///
71         void selectionRequested();
72         ///
73         void selectionLost();
74         ///
75         void cursorToggle();
76         ///
77         bool available() const;
78         /// get the change at the cursor position
79         Change const getCurrentChange();
80         ///
81         void beforeChange(LyXText *);
82         ///
83         void savePosition(unsigned int i);
84         ///
85         void restorePosition(unsigned int i);
86         ///
87         bool isSavedPosition(unsigned int i);
88         ///
89         void switchKeyMap();
90         ///
91         void insetUnlock();
92         ///
93         void showCursor();
94         ///
95         void hideCursor();
96         ///
97         void toggleSelection(bool = true);
98         ///
99         void toggleToggle();
100         ///
101         void center();
102         ///
103         bool insertInset(Inset * inset, string const & lout = string());
104         ///
105         void updateInset(Inset * inset, bool mark_dirty);
106         ///
107         bool dispatch(FuncRequest const & ev);
108 private:
109         /// track changes for the document
110         void trackChanges();
111
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         /// our workarea
152         WorkArea & workarea() const;
153 };
154 #endif // BUFFERVIEW_PIMPL_H