]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
ignore .lo in forms/ (Herbert)
[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 "commandtags.h"
15 #include "frontends/Timeout.h"
16 #include "frontends/key_state.h"
17 #include "frontends/mouse_state.h"
18 #include "frontends/LyXKeySym.h"
19 #include "box.h"
20 #include "insets/insetspecialchar.h"
21 #include "support/types.h"
22
23 #include <boost/scoped_ptr.hpp>
24 #include <boost/signals/trackable.hpp>
25
26 #ifdef __GNUG__
27 #pragma interface
28 #endif
29
30 class LyXView;
31 class WorkArea;
32 class LyXScreen;
33  
34 ///
35 struct BufferView::Pimpl : public boost::signals::trackable {
36         ///
37         Pimpl(BufferView * i, LyXView * o,
38               int xpos, int ypos, int width, int height);
39         ///
40         Painter & painter() const;
41         /// return the work area for this bview
42         WorkArea & workarea() const;
43         /// return the screen for this bview
44         LyXScreen & screen() const;
45         ///
46         void buffer(Buffer *);
47         ///
48         void resize(int xpos, int ypos, int width, int height);
49         ///
50         void resize();
51         ///
52         void redraw();
53         /// Return true if the cursor was fitted.
54         bool fitCursor();
55         ///
56         void redoCurrentBuffer();
57         ///
58         int resizeCurrentBuffer();
59         ///
60         void update();
61         //
62         void update(LyXText *, BufferView::UpdateCodes);
63         /// Update pixmap of screen
64         void updateScreen();
65         ///
66         void workAreaExpose();
67         ///
68         void updateScrollbar();
69         ///
70         void scrollDocView(int value);
71         /**
72          * Returns an inset if inset was hit, or 0 if not.
73          *
74          * If hit, the coordinates are changed relative to the inset.
75          */
76         Inset * checkInsetHit(LyXText *, int & x, int & y);
77         /// wheel mouse scroll
78         int scroll(long time);
79         ///
80         void workAreaKeyPress(LyXKeySymPtr key,
81                               key_modifier::state state);
82         ///
83         void workAreaMotionNotify(int x, int y, mouse_button::state state);
84         ///
85         void workAreaButtonPress(int x, int y, mouse_button::state button);
86         ///
87         void workAreaButtonRelease(int x, int y, mouse_button::state button);
88         ///
89         void doubleClick(int x, int y, mouse_button::state button);
90         ///
91         void tripleClick(int x, int y, mouse_button::state button);
92         ///
93         void selectionRequested();
94         ///
95         void selectionLost();
96         ///
97         void cursorToggle();
98         ///
99         void cursorPrevious(LyXText *);
100         ///
101         void cursorNext(LyXText *);
102         ///
103         bool available() const;
104         ///
105         void beforeChange(LyXText *);
106         ///
107         void savePosition(unsigned int i);
108         ///
109         void restorePosition(unsigned int i);
110         ///
111         bool isSavedPosition(unsigned int i);
112         ///
113         void setState();
114         ///
115         void insetUnlock();
116         ///
117         bool focus() const;
118         ///
119         void focus(bool);
120         ///
121         void showCursor();
122         ///
123         void hideCursor();
124         ///
125         void toggleSelection(bool = true);
126         ///
127         void toggleToggle();
128         ///
129         void center();
130         ///
131         bool insertInset(Inset * inset, string const & lout = string());
132         ///
133         void updateInset(Inset * inset, bool mark_dirty);
134         ///
135         bool Dispatch(kb_action action, string const & argument);
136 private:
137         /**
138          * Return the on-screen dimensions of the inset at the cursor.
139          * Pre-condition: the cursor must be at an inset.
140          */
141         Box insetDimensions(LyXText const & text, LyXCursor const & cursor) const;
142         /**
143          * check if the given co-ordinates are inside an inset at the given cursor,
144          * if one exists. If so, the inset is returned, and the co-ordinates are
145          * made relative. Otherwise, 0 is returned.
146          */
147         Inset * checkInset(LyXText const & text, LyXCursor const & cursor, int & x, int & y) const;
148         ///
149         friend class BufferView;
150         /// open and lock an updatable inset
151         bool open_new_inset(UpdatableInset * new_inset, bool behind = false);
152         ///
153         void specialChar(InsetSpecialChar::Kind);
154         ///
155         void newline();
156         ///
157         void hfill();
158         ///
159         void smartQuote();
160         ///
161         void insertAndEditInset(Inset *);
162         ///
163         void gotoInset(std::vector<Inset::Code> const & codes,
164                        bool same_content);
165         ///
166         void gotoInset(Inset::Code codes, bool same_content);
167         ///
168         BufferView * bv_;
169         ///
170         LyXView * owner_;
171         ///
172         Buffer * buffer_;
173         ///
174         boost::scoped_ptr<LyXScreen> screen_;
175         ///
176         boost::scoped_ptr<WorkArea> workarea_;
177         ///
178         Timeout cursor_timeout;
179         ///
180         void pasteClipboard(bool asPara);
181         ///
182         void stuffClipboard(string const &) const;
183         ///
184         bool using_xterm_cursor;
185         ///
186         struct Position {
187                 /// Filename
188                 string filename;
189                 /// Cursor paragraph Id
190                 int par_id;
191                 /// Cursor position
192                 lyx::pos_type par_pos;
193                 ///
194                 Position() : par_id(0), par_pos(0) {}
195                 ///
196                 Position(string const & f, int id, lyx::pos_type pos)
197                         : filename(f), par_id(id), par_pos(pos) {}
198         };
199         ///
200         std::vector<Position> saved_positions;
201         ///
202         void moveCursorUpdate(bool selecting, bool fitcur = true);
203         /// Get next inset of this class from current cursor position
204         Inset * getInsetByCode(Inset::Code code);
205         ///
206         void MenuInsertLyXFile(string const & filen);
207 };
208 #endif // BUFFERVIEW_PIMPL_H