mirror of
https://github.com/TES3MP/TES3MP.git
synced 2025-09-30 08:35:52 -04:00
removed grid button (discarding the first attempt at a cell selector)
This commit is contained in:
parent
0fe67b586a
commit
324b2743d4
@ -60,7 +60,7 @@ opencs_hdrs_noqt (view/doc
|
|||||||
opencs_units (view/world
|
opencs_units (view/world
|
||||||
table tablesubview scriptsubview util regionmapsubview tablebottombox creator genericcreator
|
table tablesubview scriptsubview util regionmapsubview tablebottombox creator genericcreator
|
||||||
cellcreator referenceablecreator referencecreator scenesubview scenetoolbar scenetool
|
cellcreator referenceablecreator referencecreator scenesubview scenetoolbar scenetool
|
||||||
scenetoolmode infocreator scriptedit dialoguesubview previewsubview scenetoolgrid
|
scenetoolmode infocreator scriptedit dialoguesubview previewsubview
|
||||||
)
|
)
|
||||||
|
|
||||||
opencs_units (view/render
|
opencs_units (view/render
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
#include "creator.hpp"
|
#include "creator.hpp"
|
||||||
#include "scenetoolbar.hpp"
|
#include "scenetoolbar.hpp"
|
||||||
#include "scenetoolmode.hpp"
|
#include "scenetoolmode.hpp"
|
||||||
#include "scenetoolgrid.hpp"
|
|
||||||
|
|
||||||
CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document)
|
||||||
: SubView (id)
|
: SubView (id)
|
||||||
@ -37,8 +36,6 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
|||||||
|
|
||||||
SceneToolbar *toolbar = new SceneToolbar (48+6, this);
|
SceneToolbar *toolbar = new SceneToolbar (48+6, this);
|
||||||
|
|
||||||
SceneToolGrid *gridTool = 0;
|
|
||||||
|
|
||||||
if (id.getId()=="sys::default")
|
if (id.getId()=="sys::default")
|
||||||
{
|
{
|
||||||
CSVRender::PagedWorldspaceWidget *widget = new CSVRender::PagedWorldspaceWidget (this);
|
CSVRender::PagedWorldspaceWidget *widget = new CSVRender::PagedWorldspaceWidget (this);
|
||||||
@ -47,13 +44,6 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
|||||||
SIGNAL (cellIndexChanged (const std::pair<int, int>&, const std::pair<int, int>&)),
|
SIGNAL (cellIndexChanged (const std::pair<int, int>&, const std::pair<int, int>&)),
|
||||||
this,
|
this,
|
||||||
SLOT (cellIndexChanged (const std::pair<int, int>&, const std::pair<int, int>&)));
|
SLOT (cellIndexChanged (const std::pair<int, int>&, const std::pair<int, int>&)));
|
||||||
|
|
||||||
gridTool = new SceneToolGrid (toolbar);
|
|
||||||
|
|
||||||
connect (widget,
|
|
||||||
SIGNAL (cellIndexChanged (const std::pair<int, int>&, const std::pair<int, int>&)),
|
|
||||||
gridTool,
|
|
||||||
SLOT (cellIndexChanged (const std::pair<int, int>&, const std::pair<int, int>&)));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mScene = new CSVRender::UnpagedWorldspaceWidget (id.getId(), document, this);
|
mScene = new CSVRender::UnpagedWorldspaceWidget (id.getId(), document, this);
|
||||||
@ -64,9 +54,6 @@ CSVWorld::SceneSubView::SceneSubView (const CSMWorld::UniversalId& id, CSMDoc::D
|
|||||||
SceneToolMode *lightingTool = mScene->makeLightingSelector (toolbar);
|
SceneToolMode *lightingTool = mScene->makeLightingSelector (toolbar);
|
||||||
toolbar->addTool (lightingTool);
|
toolbar->addTool (lightingTool);
|
||||||
|
|
||||||
if (gridTool)
|
|
||||||
toolbar->addTool (gridTool);
|
|
||||||
|
|
||||||
layout2->addWidget (toolbar, 0);
|
layout2->addWidget (toolbar, 0);
|
||||||
|
|
||||||
layout2->addWidget (mScene, 1);
|
layout2->addWidget (mScene, 1);
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
|
|
||||||
#include "scenetoolgrid.hpp"
|
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
|
|
||||||
#include <QPainter>
|
|
||||||
#include <QApplication>
|
|
||||||
#include <QFontMetrics>
|
|
||||||
|
|
||||||
#include "scenetoolbar.hpp"
|
|
||||||
|
|
||||||
CSVWorld::SceneToolGrid::SceneToolGrid (SceneToolbar *parent)
|
|
||||||
: SceneTool (parent), mIconSize (parent->getIconSize())
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSVWorld::SceneToolGrid::showPanel (const QPoint& position)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSVWorld::SceneToolGrid::cellIndexChanged (const std::pair<int, int>& min,
|
|
||||||
const std::pair<int, int>& max)
|
|
||||||
{
|
|
||||||
/// \todo make font size configurable
|
|
||||||
const int fontSize = 8;
|
|
||||||
|
|
||||||
/// \todo replace with proper icon
|
|
||||||
QPixmap image (mIconSize, mIconSize);
|
|
||||||
image.fill (QColor (0, 0, 0, 0));
|
|
||||||
|
|
||||||
{
|
|
||||||
QPainter painter (&image);
|
|
||||||
painter.setPen (Qt::black);
|
|
||||||
QFont font (QApplication::font().family(), fontSize);
|
|
||||||
painter.setFont (font);
|
|
||||||
|
|
||||||
QFontMetrics metrics (font);
|
|
||||||
|
|
||||||
if (min==max)
|
|
||||||
{
|
|
||||||
// single cell
|
|
||||||
std::ostringstream stream;
|
|
||||||
stream << min.first << ", " << min.second;
|
|
||||||
|
|
||||||
QString text = QString::fromUtf8 (stream.str().c_str());
|
|
||||||
|
|
||||||
painter.drawText (QPoint ((mIconSize-metrics.width (text))/2, mIconSize/2+fontSize/2),
|
|
||||||
text);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// range
|
|
||||||
{
|
|
||||||
std::ostringstream stream;
|
|
||||||
stream << min.first << ", " << min.second;
|
|
||||||
painter.drawText (QPoint (0, mIconSize),
|
|
||||||
QString::fromUtf8 (stream.str().c_str()));
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
std::ostringstream stream;
|
|
||||||
stream << max.first << ", " << max.second;
|
|
||||||
|
|
||||||
QString text = QString::fromUtf8 (stream.str().c_str());
|
|
||||||
|
|
||||||
painter.drawText (QPoint (mIconSize-metrics.width (text), fontSize), text);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon icon (image);
|
|
||||||
setIcon (icon);
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
#ifndef CSV_WORLD_SCENETOOL_GRID_H
|
|
||||||
#define CSV_WORLD_SCENETOOL_GRID_H
|
|
||||||
|
|
||||||
#include "scenetool.hpp"
|
|
||||||
|
|
||||||
namespace CSVWorld
|
|
||||||
{
|
|
||||||
class SceneToolbar;
|
|
||||||
|
|
||||||
///< \brief Cell grid selector tool
|
|
||||||
class SceneToolGrid : public SceneTool
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
int mIconSize;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
SceneToolGrid (SceneToolbar *parent);
|
|
||||||
|
|
||||||
virtual void showPanel (const QPoint& position);
|
|
||||||
|
|
||||||
public slots:
|
|
||||||
|
|
||||||
void cellIndexChanged (const std::pair<int, int>& min, const std::pair<int, int>& max);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
Loading…
x
Reference in New Issue
Block a user