2014-03-06 09:13:39 +00:00
|
|
|
|
|
|
|
#include "pagedworldspacewidget.hpp"
|
|
|
|
|
2014-04-01 08:04:14 +00:00
|
|
|
#include <sstream>
|
|
|
|
|
2014-10-05 21:20:09 +00:00
|
|
|
#include <QMouseEvent>
|
|
|
|
|
2014-06-29 14:00:06 +00:00
|
|
|
#include <OgreCamera.h>
|
2014-07-21 16:35:51 +00:00
|
|
|
#include <OgreSceneManager.h>
|
2014-10-05 08:25:37 +00:00
|
|
|
#include <OgreManualObject.h>
|
2014-10-06 19:40:28 +00:00
|
|
|
#include <OGRE/Overlay/OgreOverlayContainer.h>
|
|
|
|
#include <OGRE/Overlay/OgreOverlayManager.h>
|
2014-10-06 02:55:36 +00:00
|
|
|
#include <OgreRoot.h>
|
|
|
|
#include <OgreSceneQuery.h>
|
2014-10-05 08:25:37 +00:00
|
|
|
#include <OgreEntity.h>
|
|
|
|
|
|
|
|
#include "../../../../components/esm/loadland.hpp"
|
|
|
|
#include "textoverlay.hpp"
|
2014-04-30 12:27:11 +00:00
|
|
|
|
2014-06-29 14:00:06 +00:00
|
|
|
#include "../../model/world/tablemimedata.hpp"
|
|
|
|
#include "../../model/world/idtable.hpp"
|
|
|
|
|
2014-07-31 12:33:38 +00:00
|
|
|
#include "../widget/scenetooltoggle.hpp"
|
|
|
|
|
|
|
|
#include "elements.hpp"
|
|
|
|
|
2014-06-29 14:00:06 +00:00
|
|
|
bool CSVRender::PagedWorldspaceWidget::adjustCells()
|
|
|
|
{
|
|
|
|
bool modified = false;
|
|
|
|
bool setCamera = false;
|
|
|
|
|
2014-06-30 15:33:03 +00:00
|
|
|
const CSMWorld::IdCollection<CSMWorld::Cell>& cells = mDocument.getData().getCells();
|
|
|
|
|
2014-06-29 14:00:06 +00:00
|
|
|
{
|
|
|
|
// remove
|
|
|
|
std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter (mCells.begin());
|
|
|
|
|
|
|
|
while (iter!=mCells.end())
|
|
|
|
{
|
2014-06-30 15:33:03 +00:00
|
|
|
int index = cells.searchId (iter->first.getId (mWorldspace));
|
|
|
|
|
|
|
|
if (!mSelection.has (iter->first) || index==-1 ||
|
|
|
|
cells.getRecord (index).mState==CSMWorld::RecordBase::State_Deleted)
|
2014-06-29 14:00:06 +00:00
|
|
|
{
|
|
|
|
delete iter->second;
|
|
|
|
mCells.erase (iter++);
|
2014-07-21 16:57:35 +00:00
|
|
|
|
2014-10-05 08:25:37 +00:00
|
|
|
// destroy manual objects and entities
|
|
|
|
std::map<std::string, Ogre::Entity *>::iterator it = mEntities.find(iter->first.getId(mWorldspace));
|
|
|
|
if(it != mEntities.end())
|
|
|
|
{
|
|
|
|
getSceneManager()->destroyEntity(it->second);
|
|
|
|
mEntities.erase(it);
|
|
|
|
}
|
|
|
|
getSceneManager()->destroyManualObject("manual"+iter->first.getId(mWorldspace));
|
2014-07-21 16:57:35 +00:00
|
|
|
|
2014-06-29 14:00:06 +00:00
|
|
|
modified = true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
++iter;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (mCells.begin()==mCells.end())
|
|
|
|
setCamera = true;
|
|
|
|
|
|
|
|
// add
|
|
|
|
for (CSMWorld::CellSelection::Iterator iter (mSelection.begin()); iter!=mSelection.end();
|
|
|
|
++iter)
|
|
|
|
{
|
2014-06-30 15:33:03 +00:00
|
|
|
int index = cells.searchId (iter->getId (mWorldspace));
|
|
|
|
|
|
|
|
if (index!=0 && cells.getRecord (index).mState!=CSMWorld::RecordBase::State_Deleted &&
|
|
|
|
mCells.find (*iter)==mCells.end())
|
2014-06-29 14:00:06 +00:00
|
|
|
{
|
|
|
|
if (setCamera)
|
|
|
|
{
|
|
|
|
setCamera = false;
|
2014-10-05 08:25:37 +00:00
|
|
|
getCamera()->setPosition (ESM::Land::REAL_SIZE * iter->getX() + ESM::Land::REAL_SIZE/2,
|
|
|
|
ESM::Land::REAL_SIZE * iter->getY() + ESM::Land::REAL_SIZE/2, 0);
|
2014-06-29 14:00:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
mCells.insert (std::make_pair (*iter,
|
2014-10-05 08:25:37 +00:00
|
|
|
new Cell (mDocument.getData(), getSceneManager(), iter->getId (mWorldspace))));
|
2014-07-22 11:32:15 +00:00
|
|
|
|
2014-10-05 08:25:37 +00:00
|
|
|
Ogre::ManualObject* manual = getSceneManager()->createManualObject("manual" + iter->getId(mWorldspace));
|
2014-07-22 11:32:15 +00:00
|
|
|
|
2014-10-05 08:25:37 +00:00
|
|
|
manual->begin("BaseWhite", Ogre::RenderOperation::OT_LINE_LIST);
|
2014-07-22 11:32:15 +00:00
|
|
|
|
2014-10-05 08:25:37 +00:00
|
|
|
// define start and end point (x, y, z)
|
|
|
|
// FIXME: need terrain height to get the correct starting point
|
|
|
|
manual-> position(ESM::Land::REAL_SIZE * iter->getX() + ESM::Land::REAL_SIZE/2,
|
|
|
|
ESM::Land::REAL_SIZE * iter->getY() + ESM::Land::REAL_SIZE/2, 0);
|
|
|
|
manual-> position(ESM::Land::REAL_SIZE * iter->getX() + ESM::Land::REAL_SIZE/2,
|
|
|
|
ESM::Land::REAL_SIZE * iter->getY() + ESM::Land::REAL_SIZE/2, 2000);
|
|
|
|
manual->end();
|
|
|
|
Ogre::MeshPtr meshPtr = manual->convertToMesh("vLine" + iter->getId(mWorldspace));
|
|
|
|
Ogre::Entity* entity = getSceneManager()->createEntity(meshPtr);
|
|
|
|
getSceneManager()->getRootSceneNode()->createChildSceneNode()->attachObject(entity);
|
2014-10-05 21:20:09 +00:00
|
|
|
entity->setVisible(false);
|
2014-10-05 08:25:37 +00:00
|
|
|
|
2014-10-05 21:20:09 +00:00
|
|
|
// keep pointers so that they can be deleted later
|
2014-10-05 08:25:37 +00:00
|
|
|
mEntities.insert(std::make_pair(iter->getId(mWorldspace), entity));
|
|
|
|
|
|
|
|
CSVRender::TextOverlay *textDisp = new CSVRender::TextOverlay(entity, getCamera(), iter->getId(mWorldspace));
|
|
|
|
textDisp->enable(true);
|
|
|
|
textDisp->setCaption(iter->getId(mWorldspace));
|
|
|
|
textDisp->update();
|
|
|
|
mTextOverlays.push_back(textDisp);
|
2014-07-21 16:57:35 +00:00
|
|
|
|
2014-06-29 14:00:06 +00:00
|
|
|
modified = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return modified;
|
|
|
|
}
|
|
|
|
|
2014-10-05 21:20:09 +00:00
|
|
|
void CSVRender::PagedWorldspaceWidget::mouseReleaseEvent (QMouseEvent *event)
|
2014-10-05 08:25:37 +00:00
|
|
|
{
|
2014-10-06 23:34:30 +00:00
|
|
|
if(event->button() == Qt::RightButton)
|
2014-10-06 02:55:36 +00:00
|
|
|
{
|
2014-10-06 23:34:30 +00:00
|
|
|
std::list<TextOverlay *>::iterator iter = mTextOverlays.begin();
|
|
|
|
for(; iter != mTextOverlays.end(); ++iter)
|
2014-10-06 02:55:36 +00:00
|
|
|
{
|
2014-10-06 23:34:30 +00:00
|
|
|
if(mDisplayCellCoord &&
|
|
|
|
(*iter)->isEnabled() && (*iter)->container().contains(event->x(), event->y()))
|
|
|
|
{
|
|
|
|
std::cout << "clicked: " << (*iter)->getCaption() << std::endl;
|
|
|
|
}
|
2014-10-06 02:55:36 +00:00
|
|
|
}
|
|
|
|
}
|
2014-10-05 21:20:09 +00:00
|
|
|
}
|
2014-10-05 08:25:37 +00:00
|
|
|
|
2014-10-05 21:20:09 +00:00
|
|
|
void CSVRender::PagedWorldspaceWidget::updateOverlay()
|
|
|
|
{
|
2014-10-06 02:55:36 +00:00
|
|
|
Ogre::OverlayManager &overlayMgr = Ogre::OverlayManager::getSingleton();
|
|
|
|
Ogre::Overlay* overlay = overlayMgr.getByName("CellIDPanel");
|
|
|
|
if(overlay && !mTextOverlays.empty())
|
|
|
|
{
|
|
|
|
if(getCamera()->getViewport())
|
|
|
|
{
|
|
|
|
if((uint32_t)getCamera()->getViewport()->getVisibilityMask()
|
2014-10-06 03:21:44 +00:00
|
|
|
& (uint32_t)CSVRender::Element_CellMarker)
|
2014-10-06 02:55:36 +00:00
|
|
|
{
|
|
|
|
mDisplayCellCoord = true;
|
|
|
|
overlay->show();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mDisplayCellCoord = false;
|
|
|
|
overlay->hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-05 21:20:09 +00:00
|
|
|
if(!mTextOverlays.empty())
|
|
|
|
{
|
|
|
|
std::list<CSVRender::TextOverlay *>::iterator it = mTextOverlays.begin();
|
|
|
|
for(; it != mTextOverlays.end(); ++it)
|
2014-10-05 08:25:37 +00:00
|
|
|
{
|
2014-10-05 21:20:09 +00:00
|
|
|
(*it)->update();
|
2014-10-05 08:25:37 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-06-29 14:00:06 +00:00
|
|
|
void CSVRender::PagedWorldspaceWidget::referenceableDataChanged (const QModelIndex& topLeft,
|
|
|
|
const QModelIndex& bottomRight)
|
|
|
|
{
|
|
|
|
for (std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter (mCells.begin());
|
|
|
|
iter!=mCells.end(); ++iter)
|
|
|
|
if (iter->second->referenceableDataChanged (topLeft, bottomRight))
|
|
|
|
flagAsModified();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSVRender::PagedWorldspaceWidget::referenceableAboutToBeRemoved (
|
|
|
|
const QModelIndex& parent, int start, int end)
|
|
|
|
{
|
|
|
|
for (std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter (mCells.begin());
|
|
|
|
iter!=mCells.end(); ++iter)
|
|
|
|
if (iter->second->referenceableAboutToBeRemoved (parent, start, end))
|
|
|
|
flagAsModified();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSVRender::PagedWorldspaceWidget::referenceableAdded (const QModelIndex& parent,
|
|
|
|
int start, int end)
|
|
|
|
{
|
|
|
|
CSMWorld::IdTable& referenceables = dynamic_cast<CSMWorld::IdTable&> (
|
|
|
|
*mDocument.getData().getTableModel (CSMWorld::UniversalId::Type_Referenceables));
|
|
|
|
|
|
|
|
for (std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter (mCells.begin());
|
|
|
|
iter!=mCells.end(); ++iter)
|
|
|
|
{
|
|
|
|
QModelIndex topLeft = referenceables.index (start, 0);
|
|
|
|
QModelIndex bottomRight =
|
|
|
|
referenceables.index (end, referenceables.columnCount());
|
|
|
|
|
|
|
|
if (iter->second->referenceableDataChanged (topLeft, bottomRight))
|
|
|
|
flagAsModified();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSVRender::PagedWorldspaceWidget::referenceDataChanged (const QModelIndex& topLeft,
|
|
|
|
const QModelIndex& bottomRight)
|
|
|
|
{
|
|
|
|
for (std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter (mCells.begin());
|
|
|
|
iter!=mCells.end(); ++iter)
|
|
|
|
if (iter->second->referenceDataChanged (topLeft, bottomRight))
|
|
|
|
flagAsModified();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSVRender::PagedWorldspaceWidget::referenceAboutToBeRemoved (const QModelIndex& parent,
|
|
|
|
int start, int end)
|
|
|
|
{
|
|
|
|
for (std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter (mCells.begin());
|
|
|
|
iter!=mCells.end(); ++iter)
|
|
|
|
if (iter->second->referenceAboutToBeRemoved (parent, start, end))
|
|
|
|
flagAsModified();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSVRender::PagedWorldspaceWidget::referenceAdded (const QModelIndex& parent, int start,
|
|
|
|
int end)
|
|
|
|
{
|
|
|
|
for (std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter (mCells.begin());
|
|
|
|
iter!=mCells.end(); ++iter)
|
|
|
|
if (iter->second->referenceAdded (parent, start, end))
|
|
|
|
flagAsModified();
|
|
|
|
}
|
|
|
|
|
2014-09-06 14:11:06 +00:00
|
|
|
std::string CSVRender::PagedWorldspaceWidget::getStartupInstruction()
|
|
|
|
{
|
|
|
|
Ogre::Vector3 position = getCamera()->getPosition();
|
|
|
|
|
|
|
|
std::ostringstream stream;
|
|
|
|
|
|
|
|
stream
|
|
|
|
<< "player->position "
|
|
|
|
<< position.x << ", " << position.y << ", " << position.z
|
|
|
|
<< ", 0";
|
|
|
|
|
|
|
|
return stream.str();
|
|
|
|
}
|
|
|
|
|
2014-05-01 16:25:28 +00:00
|
|
|
CSVRender::PagedWorldspaceWidget::PagedWorldspaceWidget (QWidget* parent, CSMDoc::Document& document)
|
2014-10-06 02:55:36 +00:00
|
|
|
: WorldspaceWidget(document, parent), mDocument(document), mWorldspace("std::default"), mDisplayCellCoord(true)
|
|
|
|
, mTextOverlays(0)
|
2014-06-30 15:57:38 +00:00
|
|
|
{
|
|
|
|
QAbstractItemModel *cells =
|
|
|
|
document.getData().getTableModel (CSMWorld::UniversalId::Type_Cells);
|
|
|
|
|
|
|
|
connect (cells, SIGNAL (dataChanged (const QModelIndex&, const QModelIndex&)),
|
|
|
|
this, SLOT (cellDataChanged (const QModelIndex&, const QModelIndex&)));
|
|
|
|
connect (cells, SIGNAL (rowsRemoved (const QModelIndex&, int, int)),
|
|
|
|
this, SLOT (cellRemoved (const QModelIndex&, int, int)));
|
|
|
|
connect (cells, SIGNAL (rowsInserted (const QModelIndex&, int, int)),
|
|
|
|
this, SLOT (cellAdded (const QModelIndex&, int, int)));
|
|
|
|
}
|
2014-04-01 08:04:14 +00:00
|
|
|
|
2014-06-29 14:00:06 +00:00
|
|
|
CSVRender::PagedWorldspaceWidget::~PagedWorldspaceWidget()
|
|
|
|
{
|
|
|
|
for (std::map<CSMWorld::CellCoordinates, Cell *>::iterator iter (mCells.begin());
|
|
|
|
iter!=mCells.end(); ++iter)
|
2014-10-05 08:25:37 +00:00
|
|
|
{
|
2014-06-29 14:00:06 +00:00
|
|
|
delete iter->second;
|
2014-10-05 08:25:37 +00:00
|
|
|
|
|
|
|
std::map<std::string, Ogre::Entity *>::iterator it = mEntities.find(iter->first.getId(mWorldspace));
|
|
|
|
if(it != mEntities.end())
|
|
|
|
{
|
|
|
|
getSceneManager()->destroyEntity(it->second);
|
|
|
|
mEntities.erase(it);
|
|
|
|
}
|
|
|
|
getSceneManager()->destroyManualObject("manual"+iter->first.getId(mWorldspace));
|
|
|
|
}
|
2014-06-29 14:00:06 +00:00
|
|
|
}
|
|
|
|
|
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;
|
2014-06-29 14:00:06 +00:00
|
|
|
|
|
|
|
if (adjustCells())
|
|
|
|
flagAsModified();
|
|
|
|
|
2014-04-07 12:16:02 +00:00
|
|
|
emit cellSelectionChanged (mSelection);
|
2014-04-30 12:27:11 +00:00
|
|
|
}
|
|
|
|
|
2014-04-30 13:03:46 +00:00
|
|
|
std::pair< int, int > CSVRender::PagedWorldspaceWidget::getCoordinatesFromId (const std::string& record) const
|
|
|
|
{
|
2014-05-01 10:34:54 +00:00
|
|
|
std::istringstream stream (record.c_str());
|
|
|
|
char ignore;
|
|
|
|
int x, y;
|
2014-05-01 13:09:47 +00:00
|
|
|
stream >> ignore >> x >> y;
|
2014-04-30 13:03:46 +00:00
|
|
|
return std::make_pair(x, y);
|
|
|
|
}
|
|
|
|
|
2014-09-11 11:04:20 +00:00
|
|
|
bool CSVRender::PagedWorldspaceWidget::handleDrop (
|
|
|
|
const std::vector< CSMWorld::UniversalId >& data, DropType type)
|
2014-05-01 13:09:47 +00:00
|
|
|
{
|
2014-09-11 11:04:20 +00:00
|
|
|
if (WorldspaceWidget::handleDrop (data, type))
|
|
|
|
return true;
|
|
|
|
|
|
|
|
if (type!=Type_CellsExterior)
|
|
|
|
return false;
|
|
|
|
|
2014-05-01 13:09:47 +00:00
|
|
|
bool selectionChanged = false;
|
|
|
|
for (unsigned i = 0; i < data.size(); ++i)
|
|
|
|
{
|
|
|
|
std::pair<int, int> coordinates(getCoordinatesFromId(data[i].getId()));
|
|
|
|
if (mSelection.add(CSMWorld::CellCoordinates(coordinates.first, coordinates.second)))
|
|
|
|
{
|
|
|
|
selectionChanged = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (selectionChanged)
|
|
|
|
{
|
2014-06-29 14:00:06 +00:00
|
|
|
if (adjustCells())
|
|
|
|
flagAsModified();
|
|
|
|
|
2014-05-01 13:09:47 +00:00
|
|
|
emit cellSelectionChanged(mSelection);
|
|
|
|
}
|
2014-09-11 11:04:20 +00:00
|
|
|
|
|
|
|
return true;
|
2014-05-01 13:09:47 +00:00
|
|
|
}
|
2014-05-03 12:00:30 +00:00
|
|
|
|
2014-09-11 09:27:56 +00:00
|
|
|
CSVRender::WorldspaceWidget::dropRequirments CSVRender::PagedWorldspaceWidget::getDropRequirements (CSVRender::WorldspaceWidget::DropType type) const
|
2014-05-03 12:00:30 +00:00
|
|
|
{
|
2014-09-11 11:04:20 +00:00
|
|
|
dropRequirments requirements = WorldspaceWidget::getDropRequirements (type);
|
|
|
|
|
|
|
|
if (requirements!=ignored)
|
|
|
|
return requirements;
|
|
|
|
|
2014-05-03 12:00:30 +00:00
|
|
|
switch (type)
|
|
|
|
{
|
2014-09-11 09:27:56 +00:00
|
|
|
case Type_CellsExterior:
|
2014-05-03 12:00:30 +00:00
|
|
|
return canHandle;
|
|
|
|
|
2014-09-11 09:27:56 +00:00
|
|
|
case Type_CellsInterior:
|
2014-05-03 12:00:30 +00:00
|
|
|
return needUnpaged;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return ignored;
|
|
|
|
}
|
2014-06-30 15:57:38 +00:00
|
|
|
}
|
|
|
|
|
2014-07-31 12:33:38 +00:00
|
|
|
|
|
|
|
unsigned int CSVRender::PagedWorldspaceWidget::getElementMask() const
|
|
|
|
{
|
|
|
|
return WorldspaceWidget::getElementMask() | mControlElements->getSelection();
|
|
|
|
}
|
|
|
|
|
|
|
|
CSVWidget::SceneToolToggle *CSVRender::PagedWorldspaceWidget::makeControlVisibilitySelector (
|
|
|
|
CSVWidget::SceneToolbar *parent)
|
|
|
|
{
|
|
|
|
mControlElements = new CSVWidget::SceneToolToggle (parent,
|
|
|
|
"Controls & Guides Visibility", ":door.png");
|
|
|
|
|
|
|
|
mControlElements->addButton (":activator.png", Element_CellMarker, ":activator.png",
|
|
|
|
"Cell marker");
|
|
|
|
mControlElements->addButton (":armor.png", Element_CellArrow, ":armor.png", "Cell arrows");
|
|
|
|
mControlElements->addButton (":armor.png", Element_CellBorder, ":armor.png", "Cell border");
|
|
|
|
|
|
|
|
mControlElements->setSelection (0xffffffff);
|
|
|
|
|
|
|
|
connect (mControlElements, SIGNAL (selectionChanged()),
|
|
|
|
this, SLOT (elementSelectionChanged()));
|
|
|
|
|
|
|
|
return mControlElements;
|
|
|
|
}
|
|
|
|
|
2014-06-30 15:57:38 +00:00
|
|
|
void CSVRender::PagedWorldspaceWidget::cellDataChanged (const QModelIndex& topLeft,
|
|
|
|
const QModelIndex& bottomRight)
|
|
|
|
{
|
|
|
|
/// \todo check if no selected cell is affected and do not update, if that is the case
|
|
|
|
if (adjustCells())
|
|
|
|
flagAsModified();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSVRender::PagedWorldspaceWidget::cellRemoved (const QModelIndex& parent, int start,
|
|
|
|
int end)
|
|
|
|
{
|
|
|
|
if (adjustCells())
|
|
|
|
flagAsModified();
|
|
|
|
}
|
|
|
|
|
|
|
|
void CSVRender::PagedWorldspaceWidget::cellAdded (const QModelIndex& index, int start,
|
|
|
|
int end)
|
|
|
|
{
|
|
|
|
/// \todo check if no selected cell is affected and do not update, if that is the case
|
|
|
|
if (adjustCells())
|
|
|
|
flagAsModified();
|
2014-09-30 08:46:26 +00:00
|
|
|
}
|