1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-19 20:53:52 +00:00

disable element visibility buttons that do not apply to the respective cell type

This commit is contained in:
Marc Zinnschlag 2014-12-02 11:17:39 +01:00
parent b7cf114d5d
commit 406cf2b981
7 changed files with 29 additions and 5 deletions

View file

@ -22,6 +22,7 @@
#include "../widget/scenetooltoggle.hpp"
#include "../widget/scenetoolmode.hpp"
#include "../widget/scenetooltoggle2.hpp"
#include "editmode.hpp"
#include "elements.hpp"
@ -212,6 +213,14 @@ void CSVRender::PagedWorldspaceWidget::mouseDoubleClickEvent (QMouseEvent *event
WorldspaceWidget::mouseDoubleClickEvent(event);
}
void CSVRender::PagedWorldspaceWidget::addVisibilitySelectorButtons (
CSVWidget::SceneToolToggle2 *tool)
{
WorldspaceWidget::addVisibilitySelectorButtons (tool);
tool->addButton (Element_Terrain, "Terrain");
tool->addButton (Element_Fog, "Fog", "", true);
}
void CSVRender::PagedWorldspaceWidget::addEditModeSelectorButtons (
CSVWidget::SceneToolMode *tool)
{

View file

@ -83,6 +83,8 @@ namespace CSVRender
protected:
virtual void addVisibilitySelectorButtons (CSVWidget::SceneToolToggle2 *tool);
virtual void addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool);
virtual void updateOverlay();

View file

@ -153,6 +153,14 @@ void CSVRender::UnpagedWorldspaceWidget::referenceAdded (const QModelIndex& pare
flagAsModified();
}
void CSVRender::UnpagedWorldspaceWidget::addVisibilitySelectorButtons (
CSVWidget::SceneToolToggle2 *tool)
{
WorldspaceWidget::addVisibilitySelectorButtons (tool);
tool->addButton (Element_Terrain, "Terrain", "", true);
tool->addButton (Element_Fog, "Fog");
}
std::string CSVRender::UnpagedWorldspaceWidget::getStartupInstruction()
{
Ogre::Vector3 position = getCamera()->getPosition();

View file

@ -60,6 +60,10 @@ namespace CSVRender
virtual std::string getStartupInstruction();
protected:
virtual void addVisibilitySelectorButtons (CSVWidget::SceneToolToggle2 *tool);
private slots:
void cellDataChanged (const QModelIndex& topLeft, const QModelIndex& bottomRight);

View file

@ -263,10 +263,8 @@ void CSVRender::WorldspaceWidget::addVisibilitySelectorButtons (
CSVWidget::SceneToolToggle2 *tool)
{
tool->addButton (Element_Reference, "References");
tool->addButton (Element_Terrain, "Terrain");
tool->addButton (Element_Water, "Water");
tool->addButton (Element_Pathgrid, "Pathgrid");
tool->addButton (Element_Fog, "Fog");
}
void CSVRender::WorldspaceWidget::addEditModeSelectorButtons (CSVWidget::SceneToolMode *tool)

View file

@ -72,7 +72,7 @@ void CSVWidget::SceneToolToggle2::showPanel (const QPoint& position)
}
void CSVWidget::SceneToolToggle2::addButton (unsigned int id,
const QString& name, const QString& tooltip)
const QString& name, const QString& tooltip, bool disabled)
{
std::ostringstream stream;
stream << mSingleIcon << id;
@ -84,6 +84,9 @@ void CSVWidget::SceneToolToggle2::addButton (unsigned int id,
button->setIconSize (QSize (mIconSize, mIconSize));
button->setFixedSize (mButtonSize, mButtonSize);
if (disabled)
button->setDisabled (true);
mLayout->addWidget (button);
ButtonDesc desc;
@ -95,7 +98,7 @@ void CSVWidget::SceneToolToggle2::addButton (unsigned int id,
connect (button, SIGNAL (clicked()), this, SLOT (selected()));
if (mButtons.size()==1)
if (mButtons.size()==1 && !disabled)
mFirst = button;
}

View file

@ -56,7 +56,7 @@ namespace CSVWidget
/// \attention After the last button has been added, setSelection must be called at
/// least once to finalise the layout.
void addButton (unsigned int id,
const QString& name, const QString& tooltip = "");
const QString& name, const QString& tooltip = "", bool disabled = false);
unsigned int getSelection() const;