]> git.lyx.org Git - lyx.git/blobdiff - src/BufferView.h
* Painter.h:
[lyx.git] / src / BufferView.h
index c03a8873873dc2b897c7b176f79d7a8c044c0bd3..75f5da045397ac248101862c5fc27afe8f212651 100644 (file)
 #ifndef BUFFER_VIEW_H
 #define BUFFER_VIEW_H
 
+#include "coordcache.h"
 #include "cursor.h"
 #include "metricsinfo.h"
-
-#include "frontends/LyXKeySym.h"
-
+#include "UpdateFlags.h"
 #include "support/types.h"
 
 #include <boost/utility.hpp>
 
 #include <string>
 
+
+namespace lyx {
+
 class Buffer;
 class Change;
 class DocIterator;
 class FuncRequest;
 class FuncStatus;
+class Intl;
 class Language;
 class LCursor;
 class LyXText;
-class LyXView;
 class ParIterator;
 class ViewMetricsInfo;
 
-namespace Update {
-       enum flags {
-               FitCursor = 1,
-               Force = 2,
-               SinglePar = 4,
-               MultiParSel = 8
-       };
-
-inline flags operator|(flags const f, flags const g)
-{
-       return static_cast<flags>(int(f) | int(g));
-}
-
-inline flags operator&(flags const f, flags const g)
-{
-       return static_cast<flags>(int(f) & int(g));
-}
-
-} // namespace
-
 /// Scrollbar Parameters
 struct ScrollbarParameters
 {
@@ -87,11 +69,7 @@ struct ScrollbarParameters
  */
 class BufferView : boost::noncopyable {
 public:
-       /**
-        * Create a view with the given owner main window,
-        * of the given dimensions.
-        */
-       BufferView(LyXView * owner);
+       BufferView();
 
        ~BufferView();
 
@@ -100,9 +78,6 @@ public:
        /// return the buffer being viewed
        Buffer * buffer() const;
 
-       /// return the owning main view
-       LyXView * owner() const;
-
        /// resize event has happened
        void resize();
 
@@ -137,7 +112,7 @@ public:
        void saveSavedPositions();
 
        /// return the current change at the cursor
-       Change const getCurrentChange();
+       Change const getCurrentChange() const;
 
        /// return the lyxtext we are using
        LyXText * getLyXText();
@@ -146,7 +121,7 @@ public:
        LyXText const * getLyXText() const;
 
        /// move cursor to the named label
-       void gotoLabel(std::string const & label);
+       void gotoLabel(docstring const & label);
 
        /// set the cursor based on the given TeX source row
        void setCursorFromRow(int row);
@@ -174,7 +149,7 @@ public:
        bool dispatch(FuncRequest const & argument);
 
        ///
-       lyx::docstring const requestSelection();
+       docstring const requestSelection();
        ///
        void clearSelection();
 
@@ -184,13 +159,8 @@ public:
        /// a function should be executed from the workarea
        bool workAreaDispatch(FuncRequest const & ev);
 
-       /// clear the X selection
-       void unsetXSel();
-
-       /// access to offset
-       int offset_ref() const;
        /// access to anchor
-       lyx::pit_type anchor_ref() const;
+       pit_type anchor_ref() const;
 
        /// access to full cursor
        LCursor & cursor();
@@ -213,8 +183,40 @@ public:
        ///
        void updateMetrics(bool singlepar = false);
 
+       ///
+       CoordCache & coordCache() {
+               return coord_cache_;
+       }
+       ///
+       CoordCache const & coordCache() const {
+               return coord_cache_;
+       }
+       /// get this view's keyboard map handler
+       Intl & getIntl() { return *intl_.get(); }
+       ///
+       Intl const & getIntl() const { return *intl_.get(); }
+
        /// This signal is emitted when some message shows up.
-       boost::signal<void(lyx::docstring)> message;
+       boost::signal<void(docstring)> message;
+
+       /// This signal is emitted when some dialog needs to be shown.
+       boost::signal<void(std::string name)> showDialog;
+
+       /// This signal is emitted when some dialog needs to be shown with
+       /// some data
+       boost::signal<void(std::string name,
+               std::string data)> showDialogWithData;
+
+       /// This signal is emitted when some inset dialogs needs to be shown.
+       boost::signal<void(std::string name, std::string data,
+               InsetBase * inset)> showInsetDialog;
+
+       /// This signal is emitted when some dialogs needs to be updated.
+       boost::signal<void(std::string name,
+               std::string data)> updateDialog;
+
+       /// This signal is emitted when the layout at the cursor is changed.
+       boost::signal<void(std::string layout)> layoutChanged;
 
 private:
        ///
@@ -226,14 +228,9 @@ private:
        ///
        ScrollbarParameters scrollbarParameters_;
 
-       /// track changes for the document
-       void trackChanges();
-
        ///
        ViewMetricsInfo metrics_info_;
-
-       ///
-       LyXView * owner_;
+       CoordCache coord_cache_;
        ///
        Buffer * buffer_;
 
@@ -247,11 +244,11 @@ private:
                /// Cursor paragraph Id
                int par_id;
                /// Cursor position
-               lyx::pos_type par_pos;
+               pos_type par_pos;
                ///
                Position() : par_id(0), par_pos(0) {}
                ///
-               Position(std::string const & f, int id, lyx::pos_type pos)
+               Position(std::string const & f, int id, pos_type pos)
                        : filename(f), par_id(id), par_pos(pos) {}
        };
        ///
@@ -270,9 +267,15 @@ private:
        ///
        bool multiparsel_cache_;
        ///
-       lyx::pit_type anchor_ref_;
+       pit_type anchor_ref_;
        ///
        int offset_ref_;
+
+       /// keyboard mapping object
+       boost::scoped_ptr<Intl> const intl_;
 };
 
+
+} // namespace lyx
+
 #endif // BUFFERVIEW_H