]> git.lyx.org Git - lyx.git/blob - src/insets/updatableinset.C
make boundary property an iterator property instead of a CursorSlice property
[lyx.git] / src / insets / updatableinset.C
1 /**
2  * \file updatableinset.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Alejandro Aguilar Sierra
7  * \author Jürgen Vigna
8  * \author Lars Gullik Bjønnes
9  * \author Matthias Ettrich
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #include <config.h>
15
16 #include "updatableinset.h"
17
18 #include "BufferView.h"
19 #include "coordcache.h"
20 #include "cursor.h"
21 #include "debug.h"
22 #include "dispatchresult.h"
23 #include "funcrequest.h"
24 #include "lyxtext.h"
25
26 #include "support/convert.h"
27
28 #include <boost/assert.hpp>
29
30
31 // An updatable inset is highly editable by definition
32 InsetBase::EDITABLE UpdatableInset::editable() const
33 {
34         return HIGHLY_EDITABLE;
35 }
36
37
38 int UpdatableInset::scroll(bool) const
39 {
40         return scx;
41 }
42
43
44 void UpdatableInset::setScroll(int maxwidth, int offset) const
45 {
46         lyxerr << "UpdatableInset::setScroll: (int) " << maxwidth << ' ' <<
47 offset<< std::endl;
48
49         int const xo_ = theCoords.getInsets().x(this);
50         if (offset > 0) {
51                 if (!scx && xo_ >= 20)
52                         return;
53                 if (xo_ + offset > 20)
54                         scx = 0;
55                 // scx = - xo_;
56                 else
57                         scx += offset;
58         } else {
59 #ifdef WITH_WARNINGS
60 #warning metrics?
61 #endif
62                 if (!scx && xo_ + width() < maxwidth - 20)
63                         return;
64
65                 if (xo_ - scx + offset + width() < maxwidth - 20)
66                         scx += maxwidth - width() - xo_ - 20;
67                 else
68                         scx += offset;
69         }
70 }
71
72
73 void UpdatableInset::getCursorDim(int &, int &) const
74 {
75         BOOST_ASSERT(false);
76 }
77