2014-03-06 09:13:39 +00:00
|
|
|
|
|
|
|
#include "pagedworldspacewidget.hpp"
|
|
|
|
|
2014-04-01 08:04:14 +00:00
|
|
|
#include <sstream>
|
|
|
|
|
2014-03-06 09:13:39 +00:00
|
|
|
CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget *parent)
|
2014-04-07 12:16:02 +00:00
|
|
|
: WorldspaceWidget (parent)
|
2014-04-01 08:04:14 +00:00
|
|
|
{}
|
|
|
|
|
|
|
|
void CSVRender::PagedWorldspaceWidget::useViewHint (const std::string& hint)
|
|
|
|
{
|
|
|
|
if (!hint.empty())
|
|
|
|
{
|
2014-04-07 12:16:02 +00:00
|
|
|
CSMWorld::CellSelection selection;
|
|
|
|
|
2014-04-01 08:04:14 +00:00
|
|
|
if (hint[0]=='c')
|
|
|
|
{
|
2014-04-07 13:23:14 +00:00
|
|
|
// syntax: c:#x1 y1; #x2 y2 (number of coordinate pairs can be 0 or larger)
|
|
|
|
char ignore;
|
2014-04-01 08:04:14 +00:00
|
|
|
|
|
|
|
std::istringstream stream (hint.c_str());
|
2014-04-07 13:23:14 +00:00
|
|
|
if (stream >> ignore)
|
2014-04-01 08:04:14 +00:00
|
|
|
{
|
2014-04-07 13:23:14 +00:00
|
|
|
char ignore1; // : or ;
|
|
|
|
char ignore2; // #
|
|
|
|
int x, y;
|
|
|
|
|
|
|
|
while (stream >> ignore1 >> ignore2 >> x >> y)
|
|
|
|
selection.add (CSMWorld::CellCoordinates (x, y));
|
2014-04-01 08:04:14 +00:00
|
|
|
|
|
|
|
/// \todo adjust camera position
|
|
|
|
}
|
|
|
|
}
|
2014-04-07 13:23:14 +00:00
|
|
|
else if (hint[0]=='r')
|
|
|
|
{
|
|
|
|
/// \todo implement 'r' type hints
|
|
|
|
}
|
2014-04-07 12:16:02 +00:00
|
|
|
|
|
|
|
setCellSelection (selection);
|
2014-04-01 08:04:14 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-07 12:16:02 +00:00
|
|
|
void CSVRender::PagedWorldspaceWidget::setCellSelection (const CSMWorld::CellSelection& selection)
|
2014-04-01 08:04:14 +00:00
|
|
|
{
|
2014-04-07 12:16:02 +00:00
|
|
|
mSelection = selection;
|
|
|
|
emit cellSelectionChanged (mSelection);
|
2014-04-01 08:04:14 +00:00
|
|
|
}
|