]> git.lyx.org Git - lyx.git/blobdiff - src/bufferview_funcs.C
LFUN_UNICODE_INSERT - unicode-insert
[lyx.git] / src / bufferview_funcs.C
index 2125c5706b5eae0b73e56904c3b762aa0d0bd700..40210a018b59cb80eda917f74af0b0b9318b4400 100644 (file)
@@ -32,7 +32,6 @@
 #include "pariterator.h"
 
 #include "frontends/Alert.h"
-#include "frontends/LyXView.h"
 
 #include "insets/insetcommand.h"
 #include "insets/insettext.h"
 
 #include <sstream>
 
-using lyx::support::bformat;
+
+namespace lyx {
+
+using support::bformat;
 
 using std::istringstream;
 using std::ostringstream;
 using std::string;
 using std::vector;
+using std::find;
 
 
 namespace bv_funcs {
@@ -153,7 +156,8 @@ bool string2font(string const & data, LyXFont & font, bool & toggle)
 // the next two should probably go elsewhere
 // this give the position relative to (0, baseline) of outermost
 // paragraph
-Point coordOffset(DocIterator const & dit, bool boundary)
+Point coordOffset(BufferView const & bv, DocIterator const & dit,
+               bool boundary)
 {
        int x = 0;
        int y = 0;
@@ -163,7 +167,7 @@ Point coordOffset(DocIterator const & dit, bool boundary)
                CursorSlice const & sl = dit[i];
                int xx = 0;
                int yy = 0;
-               sl.inset().cursorPos(sl, boundary && ((i+1) == dit.depth()), xx, yy);
+               sl.inset().cursorPos(bv, sl, boundary && ((i+1) == dit.depth()), xx, yy);
                x += xx;
                y += yy;
                //lyxerr << "LCursor::getPos, i: "
@@ -198,12 +202,12 @@ Point coordOffset(DocIterator const & dit, bool boundary)
 }
 
 
-Point getPos(DocIterator const & dit, bool boundary)
+Point getPos(BufferView & bv, DocIterator const & dit, bool boundary)
 {
        CursorSlice const & bot = dit.bottom();
        CoordCache::ParPosCache::const_iterator cache_it = 
-               theCoords.getParPos().find(bot.text());
-       if (cache_it == theCoords.getParPos().end())
+               bv.coordCache().getParPos().find(bot.text());
+       if (cache_it == bv.coordCache().getParPos().end())
                return Point(-1, -1);
 
        CoordCache::InnerParPosCache const & cache = cache_it->second;
@@ -212,7 +216,7 @@ Point getPos(DocIterator const & dit, bool boundary)
                //lyxerr << "cursor out of view" << std::endl;
                return Point(-1, -1);
        }
-       Point p = coordOffset(dit, boundary); // offset from outer paragraph
+       Point p = coordOffset(bv, dit, boundary); // offset from outer paragraph
        p.y_ += it->second.y_;
        return p;
 }
@@ -221,7 +225,8 @@ Point getPos(DocIterator const & dit, bool boundary)
 // this could be used elsewhere as well?
 CurStatus status(BufferView const * bv, DocIterator const & dit)
 {
-       CoordCache::InnerParPosCache const & cache = theCoords.getParPos().find(dit.bottom().text())->second;
+       CoordCache::InnerParPosCache const & cache =
+               bv->coordCache().getParPos().find(dit.bottom().text())->second;
 
        if (cache.find(dit.bottom().pit()) != cache.end())
                return CUR_INSIDE;
@@ -316,3 +321,6 @@ void gotoInset(BufferView * bv, InsetBase_code code, bool same_content)
 
 
 } // namespace bv_funcs
+
+
+} // namespace lyx