]> git.lyx.org Git - features.git/commitdiff
use structure with named members instead of pair<int, int>...
authorAndré Pönitz <poenitz@gmx.net>
Thu, 29 Nov 2007 22:12:19 +0000 (22:12 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 29 Nov 2007 22:12:19 +0000 (22:12 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21868 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiViewSource.cpp
src/frontends/qt4/GuiViewSource.h

index d1e14c819fe975cb9c5acc462722786e792d2bbc..1a36eed31e5afb19e088a33352494ebf51842898 100644 (file)
@@ -72,12 +72,12 @@ void ViewSourceWidget::updateView()
        if (autoUpdateCB->isChecked())
                update(viewFullSourceCB->isChecked());
 
-       int beg, end;
-       boost::tie(beg, end) = controller_.getRows();
+       GuiViewSource::Row row = controller_.getRows();
        QTextCursor c = QTextCursor(viewSourceTV->document());
-       c.movePosition(QTextCursor::NextBlock, QTextCursor::MoveAnchor, beg);
+       c.movePosition(QTextCursor::NextBlock, QTextCursor::MoveAnchor, row.begin);
        c.select(QTextCursor::BlockUnderCursor);
-       c.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor, end - beg + 1);
+       c.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor,
+               row.end - row.begin + 1);
        viewSourceTV->setTextCursor(c);
 }
 
@@ -88,7 +88,8 @@ void ViewSourceWidget::update(bool full_source)
 }
 
 
-GuiViewSource::GuiViewSource(GuiView & parent, Qt::DockWidgetArea area, Qt::WindowFlags flags)
+GuiViewSource::GuiViewSource(GuiView & parent,
+               Qt::DockWidgetArea area, Qt::WindowFlags flags)
        : DockView(parent, "view-source", area, flags)
 {
        widget_ = new ViewSourceWidget(*this);
@@ -139,7 +140,7 @@ QString GuiViewSource::getContent(bool fullSource)
 }
 
 
-std::pair<int, int> GuiViewSource::getRows() const
+GuiViewSource::Row GuiViewSource::getRows() const
 {
        BufferView const * view = bufferview();
        CursorSlice beg = view->cursor().selectionBegin().bottom();
@@ -151,7 +152,10 @@ std::pair<int, int> GuiViewSource::getRows() const
                getRowFromIdPos(end.paragraph().id(), end.pos());
        int nextendrow = view->buffer().texrow().
                getRowFromIdPos(end.paragraph().id(), end.pos() + 1);
-       return std::make_pair(begrow, endrow == nextendrow ? endrow : (nextendrow - 1));
+       Row row;
+       row.begin = begrow;
+       row.end = endrow == nextendrow ? endrow : (nextendrow - 1);
+       return row;
 }
 
 
@@ -172,7 +176,7 @@ QString GuiViewSource::title() const
 
 Dialog * createGuiViewSource(GuiView & lv)
 {
-       return new GuiViewSource(static_cast<GuiView &>(lv));
+       return new GuiViewSource(lv);
 }
 
 
index 340d1d63b0d9508c09d3c4cc1890b1fca7f43cc0..51a3e94cb65e6ed11148d479e10b5fc68d5715d5 100644 (file)
@@ -87,9 +87,9 @@ public:
                \param fullSource get full source code
         */
        QString getContent(bool fullSource);
-       /** get the cursor position in the source code
-        */
-       std::pair<int, int> getRows() const;
+       // cursor position in the source code
+       struct Row { int begin; int end; };
+       Row getRows() const;
 
 private:
        /// The encapsulated widget.