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);
}
}
-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);
}
-std::pair<int, int> GuiViewSource::getRows() const
+GuiViewSource::Row GuiViewSource::getRows() const
{
BufferView const * view = bufferview();
CursorSlice beg = view->cursor().selectionBegin().bottom();
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;
}
Dialog * createGuiViewSource(GuiView & lv)
{
- return new GuiViewSource(static_cast<GuiView &>(lv));
+ return new GuiViewSource(lv);
}
\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.