]> git.lyx.org Git - lyx.git/commitdiff
Extraced from r14281 from the younes branch.
authorLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 4 Jul 2006 00:04:46 +0000 (00:04 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Tue, 4 Jul 2006 00:04:46 +0000 (00:04 +0000)
* BufferView, BufferView::pimpl:
- metrics_info_: private variable holding ViewMetricsInfo
- viewMetricsInfo(): accessor function
- updateMetrics(): renamed from metrics(), sets metrics_info_
- update(): change to use updateMetrics()

* frontends/WorkArea:
- redraw(): get the ViewMetricsInfo through accessor to BufferView.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14331 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.C
src/BufferView.h
src/BufferView_pimpl.C
src/BufferView_pimpl.h
src/frontends/WorkArea.C
src/frontends/WorkArea.h
src/metricsinfo.h

index bedd197e5704d217873d69a65a014a52d97fc54c..f1c1834b1c24523ccbe437d3d69c161b1e5c78b2 100644 (file)
@@ -37,6 +37,7 @@
 #include "texrow.h"
 #include "undo.h"
 #include "WordLangTuple.h"
+#include "metricsinfo.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Clipboard.h"
@@ -401,3 +402,9 @@ int BufferView::offset_ref() const
 {
        return pimpl_->offset_ref_;
 }
+
+
+ViewMetricsInfo const & BufferView::viewMetricsInfo()
+{
+       return pimpl_->viewMetricsInfo();
+}
index ec48a0ffcc9bb4f388c514530b057afdf200e764..924637e10c1832713f24c2d28c3bc9dacb10130f 100644 (file)
@@ -34,6 +34,7 @@ class LCursor;
 class LyXText;
 class LyXView;
 class ParIterator;
+class ViewMetricsInfo;
 
 namespace Update {
        enum flags {
@@ -223,6 +224,8 @@ public:
        void putSelectionAt(DocIterator const & cur,
                int length, bool backwards);
 
+       ///
+       ViewMetricsInfo const & viewMetricsInfo();
 private:
        ///
        class Pimpl;
index 673332de9bba2eae367bbde9d902578064d0b53d..43f384f6022cf2dfc2a628cd366f57ba633c02fb 100644 (file)
@@ -681,6 +681,12 @@ bool BufferView::Pimpl::multiParSel()
 }
 
 
+ViewMetricsInfo const & BufferView::Pimpl::viewMetricsInfo()
+{
+       return metrics_info_;
+}
+
+
 void BufferView::Pimpl::update(Update::flags flags)
 {
        lyxerr[Debug::DEBUG]
@@ -704,20 +710,20 @@ void BufferView::Pimpl::update(Update::flags flags)
                theCoords.startUpdating();
 
                // First drawing step
-               ViewMetricsInfo vi = metrics(flags & Update::SinglePar);
+               updateMetrics(flags & Update::SinglePar);
                bool forceupdate(flags & (Update::Force | Update::SinglePar));
 
                if ((flags & Update::FitCursor) && fitCursor()) {
                        forceupdate = true;
-                       vi = metrics();
+                       updateMetrics();
                }
                if ((flags & Update::MultiParSel) && multiParSel()) {
                        forceupdate = true;
-                       vi = metrics();
+                       updateMetrics();
                }
                if (forceupdate) {
                        // Second drawing step
-                       owner_->workArea()->redraw(*bv_, vi);
+                       owner_->workArea()->redraw(*bv_);
                } else {
                        // Abort updating of the coord
                        // cache - just restore the old one
@@ -1404,7 +1410,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & cmd)
 }
 
 
-ViewMetricsInfo BufferView::Pimpl::metrics(bool singlepar)
+void BufferView::Pimpl::updateMetrics(bool singlepar)
 {
        // Remove old position cache
        theCoords.clear();
@@ -1501,5 +1507,5 @@ ViewMetricsInfo BufferView::Pimpl::metrics(bool singlepar)
                << "size: " << size
                << endl;
 
-       return ViewMetricsInfo(pit1, pit2, y1, y2, singlepar, size);
+       metrics_info_ = ViewMetricsInfo(pit1, pit2, y1, y2, singlepar, size);
 }
index 7bf4d2cef64a65ae951b73f9265eafdb9cd6285b..c39e137dc2ae0b27b2e071340069bbfa5ed6297e 100644 (file)
@@ -21,6 +21,7 @@
 #include "BufferView.h"
 #include "cursor.h"
 #include "errorlist.h"
+#include "metricsinfo.h"
 
 #include "frontends/LyXKeySym.h"
 #include "frontends/Timeout.h"
@@ -117,6 +118,8 @@ public:
        */
        int height() const;
 
+       ///
+       ViewMetricsInfo const & viewMetricsInfo();
 private:
        ///
        int width_;
@@ -156,6 +159,11 @@ private:
        ///
        friend class BufferView;
 
+       ///
+       ViewMetricsInfo metrics_info_;
+       ///
+       void updateMetrics(bool singlepar = false);
+
        ///
        BufferView * bv_;
        ///
@@ -203,7 +211,5 @@ private:
        lyx::pit_type anchor_ref_;
        ///
        int offset_ref_;
-       ///
-       ViewMetricsInfo metrics(bool singlepar = false);
 };
 #endif // BUFFERVIEW_PIMPL_H
index 4dc2314b8c957218fbfffc1f911b512f33d90e4b..9abf811b11453db9b4013a852a42f5f954987a50 100644 (file)
@@ -155,9 +155,10 @@ void WorkArea::checkAndGreyOut()
 }
 
 
-void WorkArea::redraw(BufferView & bv, ViewMetricsInfo const & vi)
+void WorkArea::redraw(BufferView & bv)
 {
        greyed_out_ = false;
+       ViewMetricsInfo const & vi = bv.viewMetricsInfo();
        getPainter().start();
        paintText(*buffer_view_, vi);
        lyxerr[Debug::DEBUG] << "Redraw screen" << endl;
index 33ca042d09d06b8f0b841b20342f159c71467ba5..ad55382e601a8e561b3268d649776938cf3f7d21 100644 (file)
@@ -20,7 +20,6 @@
 #include "frontends/LyXKeySym.h"
 
 class BufferView;
-class ViewMetricsInfo;
 
 namespace lyx {
 namespace frontend {
@@ -65,7 +64,7 @@ public:
        virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
 
        /// redraw the screen, without using existing pixmap
-       virtual void redraw(BufferView & bv, ViewMetricsInfo const & vi);
+       virtual void redraw(BufferView & bv);
 
        /// grey out (no buffer)
        void greyOut();
index 84163116955aed6655a96635074848916987a527..b2366783f6266f6aeec1092895393da7e4e557e2 100644 (file)
@@ -106,9 +106,13 @@ class TextMetricsInfo {};
 class ViewMetricsInfo
 {
 public:
+       ViewMetricsInfo()
+               : p1(0), p2(0), y1(0), y2(0),
+                 singlepar(false), size(0) {}
        ViewMetricsInfo(lyx::pit_type p1, lyx::pit_type p2, int y1, int y2,
-                       bool singlepar, lyx::pit_type size) : p1(p1), p2(p2),
-                       y1(y1), y2(y2), singlepar(singlepar), size(size) {}
+                       bool singlepar, lyx::pit_type size)
+               : p1(p1), p2(p2), y1(y1), y2(y2),
+                 singlepar(singlepar), size(size) {}
        lyx::pit_type p1;
        lyx::pit_type p2;
        int y1;