]> git.lyx.org Git - lyx.git/blob - src/BufferView.h
update libtool
[lyx.git] / src / BufferView.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ====================================================== 
4  * 
5  *           LyX, The Document Processor
6  *        
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2001 The LyX Team.
9  *
10  * ====================================================== */
11
12 #ifndef BUFFER_VIEW_H
13 #define BUFFER_VIEW_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include "LString.h"
20 #include "undo.h"
21 #include "commandtags.h"
22 #include <boost/utility.hpp>
23
24 class LyXView;
25 class LyXText;
26 class TeXErrors;
27 class Buffer;
28 class LyXScreen;
29 class WorkArea;
30 class Language;
31
32 ///
33 class BufferView : boost::noncopyable {
34 public:
35         ///
36         enum UpdateCodes {
37                 ///
38                 UPDATE = 0,
39                 ///
40                 SELECT = 1,
41                 ///
42                 FITCUR = 2,
43                 ///
44                 CHANGE = 4
45         };
46                                             
47         ///
48         BufferView(LyXView * owner, int , int , int, int);
49         ///
50         ~BufferView();
51         ///
52         Buffer * buffer() const;
53         ///
54         Painter & painter();
55         ///
56         LyXScreen * screen() const;
57         ///
58         void buffer(Buffer * b);
59         ///
60         void resize(int, int, int, int);
61         ///
62         void resize();
63         ///
64         void redraw();
65         ///
66         void fitCursor(LyXText *);
67         ///
68         void update();
69         //
70         void update(LyXText *, UpdateCodes uc);
71         ///
72         void updateScrollbar();
73         ///
74         Inset * checkInsetHit(LyXText *, int & x, int & y,
75                               unsigned int button);
76         /// 
77         void redoCurrentBuffer();
78         ///
79         int resizeCurrentBuffer();
80         ///
81         void gotoInset(std::vector<Inset::Code> const & codes,
82                        bool same_content);
83         ///
84         void gotoInset(Inset::Code codes, bool same_content);
85         ///
86         void cursorPrevious(LyXText *);
87         ///
88         void cursorNext(LyXText *);
89         /// 
90         bool available() const;
91         ///
92         LyXView * owner() const;
93         ///
94         void beforeChange(LyXText *);
95         ///
96         void savePosition(unsigned int i);
97         ///
98         void restorePosition(unsigned int i);
99         ///
100         bool isSavedPosition(unsigned int i);
101         /** This holds the mapping between buffer paragraphs and screen rows.
102             This should be private...but not yet. (Lgb)
103         */
104         LyXText * text;
105         ///
106         LyXText * getLyXText() const;
107         ///
108         LyXText * getParentText(Inset * inset) const;
109         ///
110         Language const * getParentLanguage(Inset * inset) const;
111         ///
112         int workWidth() const;
113         ///
114         UpdatableInset * theLockingInset() const;
115         ///
116         void theLockingInset(UpdatableInset * inset); 
117         ///
118         void updateInset(Inset * inset, bool mark_dirty);
119         ///
120         bool inset_slept;
121         ///
122         int slx;
123         ///
124         int sly;
125         ///
126         void insetUnlock();
127         ///
128         void insetSleep();
129         ///
130         void insetWakeup();
131         ///
132         void replaceWord(string const & replacestring);
133         ///
134         void endOfSpellCheck();
135         ///
136         void selectLastWord();
137         ///
138         string const nextWord(float & value);
139         ///
140         void insertCorrectQuote();
141         ///
142         bool gotoLabel(string const & label);
143         ///
144         void paste();
145         ///
146         void cut();
147         ///
148         void copy();
149         ///
150         void pasteEnvironment();
151         ///
152         void copyEnvironment();
153         ///
154         void menuUndo();
155         ///
156         void menuRedo();
157         /// removes all autodeletable insets
158         bool removeAutoInsets();
159         ///
160         void insertErrors(TeXErrors & terr);
161         ///
162         void setCursorFromRow(int row);
163         /** Insert an inset into the buffer.
164             Placie it in a layout of lout,
165             if no_table make sure that it doesn't end up in a table.
166         */
167         bool insertInset(Inset * inset, string const & lout = string(),
168                          bool no_table = false);
169         /** Inserts a lyx file at cursor position.
170             @return #false# if it fails.
171         */
172         bool insertLyXFile(string const & file);
173         ///
174         bool lockInset(UpdatableInset * inset);
175         ///
176         void showLockedInsetCursor(int x, int y, int asc, int desc);
177         ///
178         void hideLockedInsetCursor();
179         ///
180         void fitLockedInsetCursor(int x, int y, int asc, int desc);
181         ///
182         int unlockInset(UpdatableInset * inset);
183         ///
184         void lockedInsetStoreUndo(Undo::undo_kind kind);
185         ///
186         void showCursor();
187         ///
188         void hideCursor();
189         ///
190         void toggleSelection(bool = true);
191         ///
192         void toggleToggle();
193         ///
194         void center();
195         
196         ///
197         bool focus() const;
198         ///
199         void focus(bool);
200         ///
201         bool active() const;
202         ///
203         bool belowMouse() const;
204         /// A callback for the slider in the scrollbar.
205         void scrollCB(double);
206
207         ///
208         void setState();
209
210         ///
211         void pushIntoUpdateList(Inset * i);
212         ///
213         bool ChangeInsets(Inset::Code code, string const & from, 
214                           string const & to);
215         ///
216         bool ChangeRefsIfUnique(string const & from, string const & to);
217         ///
218         bool ChangeCitationsIfUnique(string const & from, string const & to);
219         ///
220         string const getClipboard() const;
221         ///
222         void pasteClipboard(bool asPara);
223         ///
224         void stuffClipboard(string const &) const;
225         ///
226         bool Dispatch(kb_action action, string const & argument);
227 private:
228         struct Pimpl;
229         ///
230         friend struct BufferView::Pimpl;
231         ///
232         Pimpl * pimpl_;
233 };
234
235
236 ///
237 BufferView::UpdateCodes operator|(BufferView::UpdateCodes uc1,
238                                   BufferView::UpdateCodes uc2);
239
240 #endif