]> git.lyx.org Git - features.git/commitdiff
Support full screen in BufferView
authorAbdelrazak Younes <younes@lyx.org>
Sat, 9 Feb 2008 17:20:23 +0000 (17:20 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sat, 9 Feb 2008 17:20:23 +0000 (17:20 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22899 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp
src/BufferView.h
src/ParagraphMetrics.cpp
src/ParagraphMetrics.h
src/TextMetrics.cpp
src/frontends/qt4/GuiView.cpp
src/frontends/qt4/GuiWorkArea.cpp

index 4c3ab44f65e647eccecadf78bc146a75eb5a1348..d05a064d227b0297fdde37b8e7d19fd66832eba4 100644 (file)
@@ -257,7 +257,7 @@ struct BufferView::Private
 
 
 BufferView::BufferView(Buffer & buf)
-       : width_(0), height_(0), buffer_(buf), d(new Private(*this))
+       : width_(0), height_(0), full_screen_(false), buffer_(buf), d(new Private(*this))
 {
        d->xsel_cache_.set = false;
        d->intl_.initKeyMapper(lyxrc.use_kbmap);
@@ -287,6 +287,18 @@ BufferView::~BufferView()
 }
 
 
+int BufferView::rightMargin() const
+{
+       return full_screen_? width_ / 4 : 10;
+}
+
+
+int BufferView::leftMargin() const
+{
+       return full_screen_? width_ / 4 : 10;
+}
+
+
 Intl & BufferView::getIntl()
 {
        return d->intl_;
index 2fe006418818b839c25e3271dc218e8b66f8fb66..fe4eaa957fdb71fe4e397a682a40b1b640d7208b 100644 (file)
@@ -79,7 +79,7 @@ struct ScrollbarParameters
 class BufferView {
 public:
        ///
-       BufferView(Buffer & buffer);
+       explicit BufferView(Buffer & buffer);
        ///
        ~BufferView();
 
@@ -87,6 +87,15 @@ public:
        Buffer & buffer();
        Buffer const & buffer() const;
 
+       ///
+       void setFullScreen(bool full_screen) { full_screen_ = full_screen; }
+
+       /// right margin
+       int rightMargin() const;
+
+       /// left margin
+       int leftMargin() const;
+
        /// perform pending metrics updates.
        /** \c Update::FitCursor means first to do a FitCursor, and to
         * force an update if screen position changes.
@@ -282,6 +291,8 @@ private:
        ///
        int height_;
        ///
+       bool full_screen_;
+       ///
        Buffer & buffer_;
 
        struct Private;
@@ -294,9 +305,6 @@ inline int nestMargin() { return 15; }
 /// margin for changebar
 inline int changebarMargin() { return 12; }
 
-/// right margin
-inline int rightMargin() { return 10; }
-
 } // namespace lyx
 
 #endif // BUFFERVIEW_H
index 873cded4db4561e2978665d5bbc54f2a5a9a1b1a..a53605c794f411fcee6aacbfad27a6cdf4b6cf2a 100644 (file)
@@ -195,13 +195,13 @@ void ParagraphMetrics::dump() const
        }
 }
 
-int ParagraphMetrics::rightMargin(Buffer const & buffer) const
+int ParagraphMetrics::rightMargin(BufferView const & bv) const
 {
-       BufferParams const & params = buffer.params();
+       BufferParams const & params = bv.buffer().params();
        TextClass const & tclass = params.getTextClass();
        frontend::FontMetrics const & fm = theFontMetrics(params.getFont());
        int const r_margin =
-               lyx::rightMargin()
+               bv.rightMargin()
                + fm.signedWidth(tclass.rightmargin())
                + fm.signedWidth(par_->layout()->rightmargin)
                * 4 / (par_->getDepth() + 4);
index 53f5f4379a4c37b2121183e6c8fa26ee5c187bfe..e914522efa11ab2b3294863455912c41a1a8a672 100644 (file)
@@ -33,6 +33,7 @@ namespace lyx {
 typedef std::vector<Row> RowList;
 
 class Buffer;
+class BufferView;
 class BufferParams;
 class Font;
 class Inset;
@@ -76,7 +77,7 @@ public:
        /// The painter and others use this
        RowList const & rows() const { return rows_; }
        ///
-       int rightMargin(Buffer const & buffer) const;
+       int rightMargin(BufferView const & bv) const;
        ///
        int singleWidth(pos_type pos, Font const & Font) const;
 
index 93be5ae5dfd7e09d08f4292e3727ea493af7e7e6..69eef18615c3fec8c5a43a5ef50dcdbdc669dc18 100644 (file)
@@ -220,13 +220,13 @@ bool TextMetrics::metrics(MetricsInfo & mi, Dimension & dim, int min_width)
 
 int TextMetrics::rightMargin(ParagraphMetrics const & pm) const
 {
-       return main_text_? pm.rightMargin(bv_->buffer()) : 0;
+       return main_text_? pm.rightMargin(*bv_) : 0;
 }
 
 
 int TextMetrics::rightMargin(pit_type const pit) const
 {
-       return main_text_? par_metrics_[pit].rightMargin(bv_->buffer()) : 0;
+       return main_text_? par_metrics_[pit].rightMargin(*bv_) : 0;
 }
 
 
@@ -1697,7 +1697,7 @@ int TextMetrics::leftMargin(int max_width,
        int l_margin = 0;
 
        if (text_->isMainText(buffer))
-               l_margin += changebarMargin();
+               l_margin += bv_->leftMargin();
 
        l_margin += theFontMetrics(buffer.params().getFont()).signedWidth(
                tclass.leftmargin());
index 746f775e99fdff23f956aeca8bf850b3de4e0bbd..e858b95ca92c278d318fac9260250e12b8555812 100644 (file)
@@ -1827,12 +1827,14 @@ bool GuiView::dispatch(FuncRequest const & cmd)
                                        setContentsMargins(0, 0, 0, 0);
 #endif
                                        d.current_work_area_->setFrameStyle(QFrame::NoFrame);
+                                       d.current_work_area_->bufferView().setFullScreen(false);
                                        menuBar()->show();
                                        statusBar()->show();
                                } else {
                                        statusBar()->hide();
                                        menuBar()->hide();
                                        d.current_work_area_->setFrameStyle(QFrame::NoFrame);
+                                       d.current_work_area_->bufferView().setFullScreen(true);
 #if QT_VERSION >= 0x040300
                                        setContentsMargins(-2, -2, -2, -2);
 #endif
index f9fe086991b33a0cc0058423ace940b1c0d3ebef..4233c7ffae938b6ca669f28948a22620ce3932f1 100644 (file)
@@ -908,7 +908,7 @@ void GuiWorkArea::inputMethodEvent(QInputMethodEvent * e)
                rLength = 0;
        }
 
-       int const right_margin = rightMargin();
+       int const right_margin = buffer_view_->rightMargin();
        Painter::preedit_style ps;
        // Most often there would be only one line:
        preedit_lines_ = 1;