mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-27 17:46:18 +00:00
Changed: #1301 Improved ZoneBuilderBase for using in undo/redo commands.
--HG-- branch : gsoc2011-worldeditorqt
This commit is contained in:
parent
3e9e103dea
commit
a41a662edb
5 changed files with 21 additions and 11 deletions
|
@ -77,7 +77,7 @@ bool ZoneBuilderBase::init(const QString &pathName, bool displayProgress)
|
|||
return true;
|
||||
}
|
||||
|
||||
int ZoneBuilderBase::loadZoneRegion(const QString &fileName)
|
||||
int ZoneBuilderBase::loadZoneRegion(const QString &fileName, int defaultId)
|
||||
{
|
||||
LandscapeItem landItem;
|
||||
landItem.zoneRegionObject = new ZoneRegionObject();
|
||||
|
@ -88,15 +88,18 @@ int ZoneBuilderBase::loadZoneRegion(const QString &fileName)
|
|||
delete landItem.zoneRegionObject;
|
||||
return -1;
|
||||
}
|
||||
int id = defaultId;
|
||||
if (id == -1)
|
||||
id = NewLandId++;
|
||||
// landItem.builderZoneRegion = new BuilderZoneRegion(LandCounter);
|
||||
// landItem.builderZoneRegion->init(this);
|
||||
|
||||
m_landscapeSceneBase->addZoneRegion(landItem.zoneRegionObject->ligoZoneRegion());
|
||||
// landItem.rectItem = m_landscapeScene->createLayerBlackout(landItem.zoneRegionObject->ligoZoneRegion());
|
||||
m_landscapeMap.insert(NewLandId, landItem);
|
||||
m_landscapeMap.insert(id, landItem);
|
||||
|
||||
calcMask();
|
||||
return NewLandId++;
|
||||
return id;
|
||||
}
|
||||
|
||||
void ZoneBuilderBase::deleteZoneRegion(int id)
|
||||
|
|
|
@ -83,7 +83,7 @@ public:
|
|||
|
||||
/// Zone Region
|
||||
/// @{
|
||||
int loadZoneRegion(const QString &fileName);
|
||||
int loadZoneRegion(const QString &fileName, int defaultId = -1);
|
||||
void deleteZoneRegion(int id);
|
||||
int countZoneRegion() const;
|
||||
ZoneRegionObject *zoneRegion(int id) const;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
@ -34,9 +33,10 @@ namespace LandscapeEditor
|
|||
LandscapeView::LandscapeView(QWidget *parent)
|
||||
: QGraphicsView(parent),
|
||||
m_visibleGrid(true),
|
||||
m_visibleText(true),
|
||||
m_moveMouse(false)
|
||||
{
|
||||
setDragMode(ScrollHandDrag);
|
||||
//setDragMode(ScrollHandDrag);
|
||||
setTransformationAnchor(AnchorUnderMouse);
|
||||
setBackgroundBrush(QBrush(Qt::lightGray));
|
||||
//setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate);
|
||||
|
@ -62,6 +62,12 @@ void LandscapeView::setVisibleGrid(bool visible)
|
|||
scene()->update();
|
||||
}
|
||||
|
||||
void LandscapeView::setVisibleText(bool visible)
|
||||
{
|
||||
m_visibleText = visible;
|
||||
scene()->update();
|
||||
}
|
||||
|
||||
void LandscapeView::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
double numDegrees = event->delta() / 8.0;
|
||||
|
@ -118,6 +124,9 @@ void LandscapeView::drawForeground(QPainter *painter, const QRectF &rect)
|
|||
painter->setPen(QPen(Qt::white, 0, Qt::SolidLine));
|
||||
drawGrid(painter, rect);
|
||||
|
||||
if (!m_visibleText)
|
||||
return;
|
||||
|
||||
if (m_numSteps > -m_maxSteps / 4)
|
||||
{
|
||||
painter->setPen(QPen(Qt::white, 0.5, Qt::SolidLine));
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
@ -40,6 +39,7 @@ public:
|
|||
|
||||
public Q_SLOTS:
|
||||
void setVisibleGrid(bool visible);
|
||||
void setVisibleText(bool visible);
|
||||
|
||||
private Q_SLOTS:
|
||||
protected:
|
||||
|
@ -53,7 +53,7 @@ protected:
|
|||
void drawZoneNames(QPainter *painter, const QRectF &rect);
|
||||
private:
|
||||
|
||||
bool m_visibleGrid;
|
||||
bool m_visibleGrid, m_visibleText;
|
||||
int m_numSteps, m_maxSteps;
|
||||
int m_cellSize;
|
||||
bool m_moveMouse;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
// Object Viewer Qt - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
|
||||
// Copyright (C) 2010 Winch Gate Property Limited
|
||||
// Copyright (C) 2011 Dzmitry Kamiahin <dnk-88@tut.by>
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
|
@ -52,9 +51,8 @@ bool PixmapDatabase::loadPixmaps(const QString &zonePath, NLLIGO::CZoneBank &zon
|
|||
zoneBank.getCategoryValues ("zone", listNames);
|
||||
if (displayProgress)
|
||||
{
|
||||
progressDialog = new QProgressDialog();
|
||||
progressDialog = new QProgressDialog("Loading ligo zones.", "Cancel", 0, listNames.size());
|
||||
progressDialog->show();
|
||||
progressDialog->setRange(0, listNames.size());
|
||||
}
|
||||
|
||||
for (uint i = 0; i < listNames.size(); ++i)
|
||||
|
|
Loading…
Reference in a new issue