mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-09 18:52:46 +00:00
use structure with named members instead of pair<int, int>...
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21868 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
2506e0d643
commit
b06df568f3
@ -72,12 +72,12 @@ void ViewSourceWidget::updateView()
|
|||||||
if (autoUpdateCB->isChecked())
|
if (autoUpdateCB->isChecked())
|
||||||
update(viewFullSourceCB->isChecked());
|
update(viewFullSourceCB->isChecked());
|
||||||
|
|
||||||
int beg, end;
|
GuiViewSource::Row row = controller_.getRows();
|
||||||
boost::tie(beg, end) = controller_.getRows();
|
|
||||||
QTextCursor c = QTextCursor(viewSourceTV->document());
|
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.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);
|
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)
|
: DockView(parent, "view-source", area, flags)
|
||||||
{
|
{
|
||||||
widget_ = new ViewSourceWidget(*this);
|
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();
|
BufferView const * view = bufferview();
|
||||||
CursorSlice beg = view->cursor().selectionBegin().bottom();
|
CursorSlice beg = view->cursor().selectionBegin().bottom();
|
||||||
@ -151,7 +152,10 @@ std::pair<int, int> GuiViewSource::getRows() const
|
|||||||
getRowFromIdPos(end.paragraph().id(), end.pos());
|
getRowFromIdPos(end.paragraph().id(), end.pos());
|
||||||
int nextendrow = view->buffer().texrow().
|
int nextendrow = view->buffer().texrow().
|
||||||
getRowFromIdPos(end.paragraph().id(), end.pos() + 1);
|
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)
|
Dialog * createGuiViewSource(GuiView & lv)
|
||||||
{
|
{
|
||||||
return new GuiViewSource(static_cast<GuiView &>(lv));
|
return new GuiViewSource(lv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,9 +87,9 @@ public:
|
|||||||
\param fullSource get full source code
|
\param fullSource get full source code
|
||||||
*/
|
*/
|
||||||
QString getContent(bool fullSource);
|
QString getContent(bool fullSource);
|
||||||
/** get the cursor position in the source code
|
// cursor position in the source code
|
||||||
*/
|
struct Row { int begin; int end; };
|
||||||
std::pair<int, int> getRows() const;
|
Row getRows() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// The encapsulated widget.
|
/// The encapsulated widget.
|
||||||
|
Loading…
Reference in New Issue
Block a user