]> git.lyx.org Git - lyx.git/blob - src/BufferView_pimpl.h
Collapse all those LFUN_XYZ_APPLY to a single LFUN_INSET_APPLY.
[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
23 class Change;
24 class LyXView;
25 class WorkArea;
26 class LyXScreen;
27 class FuncRequest;
28
29 ///
30 struct BufferView::Pimpl : public boost::signals::trackable {
31         ///
32         Pimpl(BufferView * i, LyXView * o,
33               int xpos, int ypos, int width, int height);
34         ///
35         Painter & painter() const;
36         /// return the screen for this bview
37         LyXScreen & screen() const;
38         ///
39         void buffer(Buffer *);
40         /// Return true if the cursor was fitted.
41         bool fitCursor();
42         ///
43         void redoCurrentBuffer();
44         ///
45         int resizeCurrentBuffer();
46         ///
47         void update();
48         //
49         void update(LyXText *, BufferView::UpdateCodes);
50         /**
51          * Repaint pixmap. Used for when we've made a visible
52          * change but don't need the full update() logic
53          */
54         void repaint();
55         ///
56         void workAreaResize();
57         ///
58         void updateScrollbar();
59         ///
60         void scrollDocView(int value);
61         /**
62          * Wheel mouse scroll, move by multiples of text->defaultRowHeight().
63          */
64         void scroll(int lines);
65         ///
66         void workAreaKeyPress(LyXKeySymPtr key, key_modifier::state state);
67         ///
68         void selectionRequested();
69         ///
70         void selectionLost();
71         ///
72         void cursorToggle();
73         ///
74         bool available() const;
75         /// get the change at the cursor position
76         Change const getCurrentChange();
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         /// track changes for the document
107         void trackChanges();
108
109         ///
110         friend class BufferView;
111
112         ///
113         BufferView * bv_;
114         ///
115         LyXView * owner_;
116         ///
117         Buffer * buffer_;
118         ///
119         boost::scoped_ptr<LyXScreen> screen_;
120         ///
121         boost::scoped_ptr<WorkArea> workarea_;
122         ///
123         Timeout cursor_timeout;
124         ///
125         void stuffClipboard(string const &) const;
126         ///
127         bool using_xterm_cursor;
128         ///
129         struct Position {
130                 /// Filename
131                 string filename;
132                 /// Cursor paragraph Id
133                 int par_id;
134                 /// Cursor position
135                 lyx::pos_type par_pos;
136                 ///
137                 Position() : par_id(0), par_pos(0) {}
138                 ///
139                 Position(string const & f, int id, lyx::pos_type pos)
140                         : filename(f), par_id(id), par_pos(pos) {}
141         };
142         ///
143         std::vector<Position> saved_positions;
144         /// Get next inset of this class from current cursor position
145         Inset * getInsetByCode(Inset::Code code);
146         ///
147         void MenuInsertLyXFile(string const & filen);
148         /// our workarea
149         WorkArea & workarea() const;
150 };
151 #endif // BUFFERVIEW_PIMPL_H