|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/schematicviewer.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzQt includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/schematicnode.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/fxschematicnode.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/schematicgroupeditor.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/stageschematicscene.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/fxschematicscene.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/menubarcommand.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/tselectionhandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/gutil.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/imageutils.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonzqt/dvscrollwidget.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// TnzLib includes
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txsheethandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tcolumnhandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tobjecthandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tfxhandle.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txsheet.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshlevelcolumn.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tcolumnfx.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/txshzeraryfxcolumn.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/preferences.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/fxdag.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tapplication.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "toonz/tscenehandle.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Qt includes
|
|
Toshihiro Shimizu |
890ddd |
#include <qgraphicsscenemouseevent></qgraphicsscenemouseevent>
|
|
Toshihiro Shimizu |
890ddd |
#include <qmouseevent></qmouseevent>
|
|
Campbell Barton |
d0e335 |
#include <qgraphicsitem></qgraphicsitem>
|
|
Toshihiro Shimizu |
890ddd |
#include <qtoolbar></qtoolbar>
|
|
Toshihiro Shimizu |
890ddd |
#include <qtoolbutton></qtoolbutton>
|
|
Toshihiro Shimizu |
890ddd |
#include <qmenu></qmenu>
|
|
Toshihiro Shimizu |
890ddd |
#include <qicon></qicon>
|
|
Toshihiro Shimizu |
890ddd |
#include <qaction></qaction>
|
|
Toshihiro Shimizu |
890ddd |
#include <qmainwindow></qmainwindow>
|
|
Toshihiro Shimizu |
890ddd |
#include <qvboxlayout></qvboxlayout>
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// STD includes
|
|
Toshihiro Shimizu |
890ddd |
#include "assert.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "math.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
namespace
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class SchematicZoomer : public ImageUtils::ShortcutZoomer
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Toshihiro Shimizu |
890ddd |
SchematicZoomer(QWidget *parent) : ShortcutZoomer(parent) {}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool zoom(bool zoomin, bool resetZoom)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
static_cast<schematicsceneviewer *="">(getWidget())->zoomQt(zoomin, resetZoom);</schematicsceneviewer>
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
} // namespace
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// SchematicScene
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SchematicScene::SchematicScene(QWidget *parent)
|
|
Toshihiro Shimizu |
890ddd |
: QGraphicsScene(parent)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setSceneRect(0, 0, 50000, 50000);
|
|
Toshihiro Shimizu |
890ddd |
setItemIndexMethod(NoIndex);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SchematicScene::~SchematicScene()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
clearAllItems();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicScene::showEvent(QShowEvent *se)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TSelectionHandle *selHandle = TSelectionHandle::getCurrent();
|
|
Toshihiro Shimizu |
890ddd |
connect(selHandle, SIGNAL(selectionSwitched(TSelection *, TSelection *)), this, SLOT(onSelectionSwitched(TSelection *, TSelection *)));
|
|
Toshihiro Shimizu |
890ddd |
clearSelection();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicScene::hideEvent(QHideEvent *se)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TSelectionHandle *selHandle = TSelectionHandle::getCurrent();
|
|
Toshihiro Shimizu |
890ddd |
disconnect(selHandle, SIGNAL(selectionSwitched(TSelection *, TSelection *)), this, SLOT(onSelectionSwitched(TSelection *, TSelection *)));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! Removes and then deletes all item in the scene.
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicScene::clearAllItems()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
clearSelection();
|
|
Toshihiro Shimizu |
890ddd |
m_highlightedLinks.clear();
|
|
Toshihiro Shimizu |
890ddd |
QList<schematicwindoweditor *=""> editors;</schematicwindoweditor>
|
|
Toshihiro Shimizu |
890ddd |
QList<schematicnode *=""> nodes;</schematicnode>
|
|
Toshihiro Shimizu |
890ddd |
QList<schematiclink *=""> links;</schematiclink>
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
QList<qgraphicsitem *=""> sceneItems = items();</qgraphicsitem>
|
|
Toshihiro Shimizu |
890ddd |
int size = sceneItems.size();
|
|
Toshihiro Shimizu |
890ddd |
//create nodes and links list
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < size; i++) {
|
|
Toshihiro Shimizu |
890ddd |
QGraphicsItem *item = sceneItems.at(i);
|
|
Toshihiro Shimizu |
890ddd |
SchematicWindowEditor *editor = dynamic_cast<schematicwindoweditor *="">(item);</schematicwindoweditor>
|
|
Toshihiro Shimizu |
890ddd |
SchematicNode *node = dynamic_cast<schematicnode *="">(item);</schematicnode>
|
|
Toshihiro Shimizu |
890ddd |
SchematicLink *link = dynamic_cast<schematiclink *="">(item);</schematiclink>
|
|
Toshihiro Shimizu |
890ddd |
if (editor)
|
|
Toshihiro Shimizu |
890ddd |
editors.append(editor);
|
|
Toshihiro Shimizu |
890ddd |
if (node)
|
|
Toshihiro Shimizu |
890ddd |
nodes.append(node);
|
|
Toshihiro Shimizu |
890ddd |
if (link)
|
|
Toshihiro Shimizu |
890ddd |
links.append(link);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
while (links.size() > 0) {
|
|
Toshihiro Shimizu |
890ddd |
SchematicLink *link = links.back();
|
|
Toshihiro Shimizu |
890ddd |
removeItem(link);
|
|
Toshihiro Shimizu |
890ddd |
links.removeLast();
|
|
Toshihiro Shimizu |
890ddd |
SchematicPort *startPort = link->getStartPort();
|
|
Toshihiro Shimizu |
890ddd |
SchematicPort *endPort = link->getEndPort();
|
|
Toshihiro Shimizu |
890ddd |
if (startPort)
|
|
Toshihiro Shimizu |
890ddd |
startPort->removeLink(link);
|
|
Toshihiro Shimizu |
890ddd |
if (endPort)
|
|
Toshihiro Shimizu |
890ddd |
endPort->removeLink(link);
|
|
Toshihiro Shimizu |
890ddd |
delete link;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
while (editors.size() > 0) {
|
|
Toshihiro Shimizu |
890ddd |
SchematicWindowEditor *editor = editors.back();
|
|
Toshihiro Shimizu |
890ddd |
removeItem(editor);
|
|
Toshihiro Shimizu |
890ddd |
editors.removeLast();
|
|
Toshihiro Shimizu |
890ddd |
delete editor;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
while (nodes.size() > 0) {
|
|
Toshihiro Shimizu |
890ddd |
SchematicNode *node = nodes.back();
|
|
Toshihiro Shimizu |
890ddd |
removeItem(node);
|
|
Toshihiro Shimizu |
890ddd |
nodes.removeLast();
|
|
Toshihiro Shimizu |
890ddd |
delete node;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
assert(items().size() == 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
/*! check if any item exists in the rect
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
bool SchematicScene::isAnEmptyZone(const QRectF &rect)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QList<qgraphicsitem *=""> allItems = items();</qgraphicsitem>
|
|
Toshihiro Shimizu |
890ddd |
QList<qgraphicsitem *="">::iterator it = allItems.begin();</qgraphicsitem>
|
|
Toshihiro Shimizu |
890ddd |
for (it; it != allItems.end(); it++) {
|
|
Toshihiro Shimizu |
890ddd |
SchematicNode *node = dynamic_cast<schematicnode *="">(*it);</schematicnode>
|
|
Toshihiro Shimizu |
890ddd |
if (!node)
|
|
Toshihiro Shimizu |
890ddd |
continue;
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicNode *fxNode = dynamic_cast<fxschematicnode *="">(node);</fxschematicnode>
|
|
Toshihiro Shimizu |
890ddd |
if (fxNode && fxNode->isA(eXSheetFx))
|
|
Toshihiro Shimizu |
890ddd |
continue;
|
|
Toshihiro Shimizu |
890ddd |
if ((*it)->boundingRect().translated((*it)->scenePos()).intersects(rect))
|
|
Toshihiro Shimizu |
890ddd |
return false;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
return true;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QVector<schematicnode *=""> SchematicScene::getPlacedNode(SchematicNode *node)</schematicnode>
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QRectF rect = node->boundingRect().translated(node->scenePos());
|
|
Toshihiro Shimizu |
890ddd |
QList<qgraphicsitem *=""> allItems = items();</qgraphicsitem>
|
|
Toshihiro Shimizu |
890ddd |
QList<qgraphicsitem *="">::iterator it = allItems.begin();</qgraphicsitem>
|
|
Toshihiro Shimizu |
890ddd |
QVector<schematicnode *=""> nodes;</schematicnode>
|
|
Toshihiro Shimizu |
890ddd |
for (it; it != allItems.end(); it++) {
|
|
Toshihiro Shimizu |
890ddd |
SchematicNode *placedNode = dynamic_cast<schematicnode *="">(*it);</schematicnode>
|
|
Toshihiro Shimizu |
890ddd |
if (!placedNode || placedNode == node)
|
|
Toshihiro Shimizu |
890ddd |
continue;
|
|
Toshihiro Shimizu |
890ddd |
QRectF nodeRect = placedNode->boundingRect().translated(placedNode->scenePos());
|
|
Toshihiro Shimizu |
890ddd |
QRectF enlargedRect = rect.adjusted(-10, -10, 10, 10);
|
|
Toshihiro Shimizu |
890ddd |
if (enlargedRect.contains(nodeRect))
|
|
Toshihiro Shimizu |
890ddd |
nodes.push_back(placedNode);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
return nodes;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// SchematicSceneViewer
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SchematicSceneViewer::SchematicSceneViewer(QWidget *parent)
|
|
Toshihiro Shimizu |
890ddd |
: QGraphicsView(parent), m_buttonState(Qt::NoButton), m_oldWinPos(), m_oldScenePos(), m_firstShowing(true)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
setObjectName("SchematicSceneViewer");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
Toshihiro Shimizu |
890ddd |
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
Toshihiro Shimizu |
890ddd |
setDragMode(QGraphicsView::NoDrag);
|
|
Toshihiro Shimizu |
890ddd |
setTransformationAnchor(QGraphicsView::NoAnchor);
|
|
Toshihiro Shimizu |
890ddd |
setRenderHint(QPainter::SmoothPixmapTransform);
|
|
Toshihiro Shimizu |
890ddd |
setRenderHint(QPainter::TextAntialiasing);
|
|
Toshihiro Shimizu |
890ddd |
setRenderHint(QPainter::Antialiasing);
|
|
Toshihiro Shimizu |
890ddd |
setInteractive(true);
|
|
Toshihiro Shimizu |
890ddd |
setViewportUpdateMode(QGraphicsView::SmartViewportUpdate);
|
|
Toshihiro Shimizu |
890ddd |
show();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SchematicSceneViewer::~SchematicSceneViewer()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! Reimplemets the QGraphicsView::mousePressEvent()
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void SchematicSceneViewer::mousePressEvent(QMouseEvent *me)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_buttonState = me->button();
|
|
Toshihiro Shimizu |
890ddd |
m_oldWinPos = me->pos();
|
|
Toshihiro Shimizu |
890ddd |
m_oldScenePos = mapToScene(m_oldWinPos);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool drawRect = true;
|
|
Toshihiro Shimizu |
890ddd |
QList<qgraphicsitem *=""> pointedItems = items(me->pos());</qgraphicsitem>
|
|
Toshihiro Shimizu |
890ddd |
int i;
|
|
Toshihiro Shimizu |
890ddd |
for (i = 0; i < pointedItems.size(); i++) {
|
|
Toshihiro Shimizu |
890ddd |
SchematicWindowEditor *editor = dynamic_cast<schematicwindoweditor *="">(pointedItems[i]);</schematicwindoweditor>
|
|
Toshihiro Shimizu |
890ddd |
if (!editor) {
|
|
Toshihiro Shimizu |
890ddd |
drawRect = false;
|
|
Toshihiro Shimizu |
890ddd |
break;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_buttonState == Qt::LeftButton && drawRect)
|
|
Toshihiro Shimizu |
890ddd |
setDragMode(QGraphicsView::RubberBandDrag);
|
|
Toshihiro Shimizu |
890ddd |
QGraphicsView::mousePressEvent(me);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! Reimplemets the QGraphicsView::mouseMoveEvent()
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void SchematicSceneViewer::mouseMoveEvent(QMouseEvent *me)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QPoint currWinPos = me->pos();
|
|
Toshihiro Shimizu |
890ddd |
QPointF currScenePos = mapToScene(currWinPos);
|
|
Toshihiro Shimizu |
890ddd |
if (m_buttonState == Qt::MidButton) {
|
|
Toshihiro Shimizu |
890ddd |
//Panning
|
|
Toshihiro Shimizu |
890ddd |
setInteractive(false);
|
|
Toshihiro Shimizu |
890ddd |
// I need to disable QGraphicsView event handling to avoid the generation of 'virtual' mouseMoveEvent
|
|
Toshihiro Shimizu |
890ddd |
QPointF delta = currScenePos - m_oldScenePos;
|
|
Toshihiro Shimizu |
890ddd |
translate(delta.x(), delta.y());
|
|
Toshihiro Shimizu |
890ddd |
currScenePos = mapToScene(currWinPos);
|
|
Toshihiro Shimizu |
890ddd |
// translate has changed the matrix affecting the mapToScene() method. I have to recompute currScenePos
|
|
Toshihiro Shimizu |
890ddd |
setInteractive(true);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
m_oldWinPos = currWinPos;
|
|
Toshihiro Shimizu |
890ddd |
m_oldScenePos = currScenePos;
|
|
Toshihiro Shimizu |
890ddd |
QGraphicsView::mouseMoveEvent(me);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! Reimplemets the QGraphicsView::mouseReleaseEvent()
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void SchematicSceneViewer::mouseReleaseEvent(QMouseEvent *me)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_buttonState = Qt::NoButton;
|
|
Toshihiro Shimizu |
890ddd |
QGraphicsView::mouseReleaseEvent(me);
|
|
Toshihiro Shimizu |
890ddd |
setDragMode(QGraphicsView::NoDrag);
|
|
Toshihiro Shimizu |
890ddd |
//update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicSceneViewer::keyPressEvent(QKeyEvent *ke)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
ke->ignore();
|
|
Toshihiro Shimizu |
890ddd |
QGraphicsView::keyPressEvent(ke);
|
|
Toshihiro Shimizu |
890ddd |
if (!ke->isAccepted())
|
|
Toshihiro Shimizu |
890ddd |
SchematicZoomer(this).exec(ke);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! Reimplemets the QGraphicsView::wheelEvent()
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void SchematicSceneViewer::wheelEvent(QWheelEvent *me)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
me->accept();
|
|
Toshihiro Shimizu |
890ddd |
double factor = exp(me->delta() * 0.001);
|
|
Toshihiro Shimizu |
890ddd |
changeScale(me->pos(), factor);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicSceneViewer::zoomQt(bool zoomin, bool resetZoom)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
#if QT_VERSION >= 0x050000
|
|
Toshihiro Shimizu |
890ddd |
double scale2 = matrix().determinant();
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
double scale2 = matrix().det();
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// if the zoom scale is changed over 100% in FxSchematic, call updateScene
|
|
Toshihiro Shimizu |
890ddd |
bool beforeIsLarge = (scale2 >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (resetZoom || ((scale2 < 100000 || !zoomin) && (scale2 > 0.001 * 0.05 || zoomin))) {
|
|
Toshihiro Shimizu |
890ddd |
double oldZoomScale = sqrt(scale2);
|
|
Toshihiro Shimizu |
890ddd |
double zoomScale = resetZoom ? 1 : ImageUtils::getQuantizedZoomFactor(oldZoomScale, zoomin);
|
|
Toshihiro Shimizu |
890ddd |
QMatrix scale = QMatrix().scale(zoomScale / oldZoomScale, zoomScale / oldZoomScale);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//See QGraphicsView::mapToScene()'s doc for details
|
|
Toshihiro Shimizu |
890ddd |
QRect rect(0, 0, width(), height());
|
|
Toshihiro Shimizu |
890ddd |
QRectF sceneCenterRect(mapToScene(QRect(rect.center(), QSize(2, 2))).boundingRect());
|
|
Toshihiro Shimizu |
890ddd |
setMatrix(scale, true);
|
|
Toshihiro Shimizu |
890ddd |
centerOn(sceneCenterRect.center());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#if QT_VERSION >= 0x050000
|
|
Toshihiro Shimizu |
890ddd |
bool afterIsLarge = (matrix().determinant() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
bool afterIsLarge = (matrix().det() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
if (beforeIsLarge != afterIsLarge) {
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicScene *fxScene = qobject_cast<fxschematicscene *="">(scene());</fxschematicscene>
|
|
Toshihiro Shimizu |
890ddd |
if (fxScene)
|
|
Toshihiro Shimizu |
890ddd |
fxScene->updateScene();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
/*! The view is scaled around the point \b winPos by \b scaleFactor;
|
|
Toshihiro Shimizu |
890ddd |
*/
|
|
Toshihiro Shimizu |
890ddd |
void SchematicSceneViewer::changeScale(const QPoint &winPos, qreal scaleFactor)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
#if QT_VERSION >= 0x050000
|
|
Toshihiro Shimizu |
890ddd |
bool beforeIsLarge = (matrix().determinant() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
bool beforeIsLarge = (matrix().det() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
QPointF startScenePos = mapToScene(winPos);
|
|
Toshihiro Shimizu |
890ddd |
QMatrix scale = QMatrix().scale(scaleFactor, scaleFactor);
|
|
Toshihiro Shimizu |
890ddd |
setMatrix(scale, true);
|
|
Toshihiro Shimizu |
890ddd |
QPointF endScenePos = mapToScene(winPos);
|
|
Toshihiro Shimizu |
890ddd |
QPointF delta = endScenePos - startScenePos;
|
|
Toshihiro Shimizu |
890ddd |
translate(delta.x(), delta.y());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#if QT_VERSION >= 0x050000
|
|
Toshihiro Shimizu |
890ddd |
bool afterIsLarge = (matrix().determinant() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
bool afterIsLarge = (matrix().det() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
if (beforeIsLarge != afterIsLarge) {
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicScene *fxScene = qobject_cast<fxschematicscene *="">(scene());</fxschematicscene>
|
|
Toshihiro Shimizu |
890ddd |
if (fxScene)
|
|
Toshihiro Shimizu |
890ddd |
fxScene->updateScene();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicSceneViewer::fitScene()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (scene()) {
|
|
Toshihiro Shimizu |
890ddd |
#if QT_VERSION >= 0x050000
|
|
Toshihiro Shimizu |
890ddd |
bool beforeIsLarge = (matrix().determinant() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
bool beforeIsLarge = (matrix().det() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QRectF rect = scene()->itemsBoundingRect();
|
|
Toshihiro Shimizu |
890ddd |
fitInView(rect, Qt::KeepAspectRatio);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#if QT_VERSION >= 0x050000
|
|
Toshihiro Shimizu |
890ddd |
bool afterIsLarge = (matrix().determinant() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
bool afterIsLarge = (matrix().det() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
if (beforeIsLarge != afterIsLarge) {
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicScene *fxScene = qobject_cast<fxschematicscene *="">(scene());</fxschematicscene>
|
|
Toshihiro Shimizu |
890ddd |
if (fxScene)
|
|
Toshihiro Shimizu |
890ddd |
fxScene->updateScene();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicSceneViewer::centerOnCurrent()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
SchematicScene *schematicScene = dynamic_cast<schematicscene *="">(scene());</schematicscene>
|
|
Toshihiro Shimizu |
890ddd |
QGraphicsItem *node = schematicScene->getCurrentNode();
|
|
Toshihiro Shimizu |
890ddd |
if (node)
|
|
Toshihiro Shimizu |
890ddd |
centerOn(node);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicSceneViewer::reorderScene()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
SchematicScene *schematicScene = dynamic_cast<schematicscene *="">(scene());</schematicscene>
|
|
Toshihiro Shimizu |
890ddd |
schematicScene->reorderScene();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicSceneViewer::normalizeScene()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#if QT_VERSION >= 0x050000
|
|
Toshihiro Shimizu |
890ddd |
bool beforeIsLarge = (matrix().determinant() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
bool beforeIsLarge = (matrix().det() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
//See QGraphicsView::mapToScene()'s doc for details
|
|
Toshihiro Shimizu |
890ddd |
QRect rect(0, 0, width(), height());
|
|
Toshihiro Shimizu |
890ddd |
QRectF sceneCenterRect(mapToScene(QRect(rect.center(), QSize(2, 2))).boundingRect());
|
|
Toshihiro Shimizu |
890ddd |
resetMatrix();
|
|
Toshihiro Shimizu |
890ddd |
#if defined(MACOSX)
|
|
Toshihiro Shimizu |
890ddd |
scale(1.32, 1.32);
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
centerOn(sceneCenterRect.center());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#if QT_VERSION >= 0x050000
|
|
Toshihiro Shimizu |
890ddd |
bool afterIsLarge = (matrix().determinant() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#else
|
|
Toshihiro Shimizu |
890ddd |
bool afterIsLarge = (matrix().det() >= 1.0);
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
if (beforeIsLarge != afterIsLarge) {
|
|
Toshihiro Shimizu |
890ddd |
FxSchematicScene *fxScene = qobject_cast<fxschematicscene *="">(scene());</fxschematicscene>
|
|
Toshihiro Shimizu |
890ddd |
if (fxScene)
|
|
Toshihiro Shimizu |
890ddd |
fxScene->updateScene();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicSceneViewer::showEvent(QShowEvent *se)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QGraphicsView::showEvent(se);
|
|
Toshihiro Shimizu |
890ddd |
if (m_firstShowing) {
|
|
Toshihiro Shimizu |
890ddd |
m_firstShowing = false;
|
|
Toshihiro Shimizu |
890ddd |
QRectF rect = scene()->itemsBoundingRect();
|
|
Toshihiro Shimizu |
890ddd |
resetMatrix();
|
|
Toshihiro Shimizu |
890ddd |
centerOn(rect.center());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// SchematicViewer
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//==================================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SchematicViewer::SchematicViewer(QWidget *parent)
|
|
Toshihiro Shimizu |
890ddd |
: QWidget(parent), m_fullSchematic(true), m_maximizedNode(false), m_sceneHandle(0)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_viewer = new SchematicSceneViewer(this);
|
|
Toshihiro Shimizu |
890ddd |
m_stageScene = new StageSchematicScene(this);
|
|
Toshihiro Shimizu |
890ddd |
m_fxScene = new FxSchematicScene(this);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_commonToolbar = new QToolBar(m_viewer);
|
|
Toshihiro Shimizu |
890ddd |
m_stageToolbar = new QToolBar(m_viewer);
|
|
Toshihiro Shimizu |
890ddd |
m_fxToolbar = new QToolBar(m_viewer);
|
|
Toshihiro Shimizu |
890ddd |
m_swapToolbar = new QToolBar(m_viewer);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_commonToolbar->setObjectName("ToolBarWithoutBorder");
|
|
Toshihiro Shimizu |
890ddd |
m_stageToolbar->setObjectName("ToolBarWithoutBorder");
|
|
Toshihiro Shimizu |
890ddd |
m_fxToolbar->setObjectName("ToolBarWithoutBorder");
|
|
Toshihiro Shimizu |
890ddd |
m_swapToolbar->setObjectName("ToolBarWithoutBorder");
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
createToolbars();
|
|
Toshihiro Shimizu |
890ddd |
createActions();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// layout
|
|
Toshihiro Shimizu |
890ddd |
QVBoxLayout *mainLayout = new QVBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
mainLayout->setMargin(1);
|
|
Toshihiro Shimizu |
890ddd |
mainLayout->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
mainLayout->addWidget(m_viewer, 1);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QFrame *bottomFrame = new QFrame(this);
|
|
Toshihiro Shimizu |
890ddd |
bottomFrame->setObjectName("SchematicBottomFrame");
|
|
Toshihiro Shimizu |
890ddd |
QHBoxLayout *horizontalLayout = new QHBoxLayout();
|
|
Toshihiro Shimizu |
890ddd |
horizontalLayout->setMargin(0);
|
|
Toshihiro Shimizu |
890ddd |
horizontalLayout->setSpacing(0);
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
horizontalLayout->addWidget(m_commonToolbar);
|
|
Toshihiro Shimizu |
890ddd |
horizontalLayout->addStretch();
|
|
Toshihiro Shimizu |
890ddd |
horizontalLayout->addWidget(m_fxToolbar);
|
|
Toshihiro Shimizu |
890ddd |
horizontalLayout->addWidget(m_stageToolbar);
|
|
Toshihiro Shimizu |
890ddd |
horizontalLayout->addWidget(m_swapToolbar);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
bottomFrame->setLayout(horizontalLayout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
mainLayout->addWidget(bottomFrame, 0);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
setLayout(mainLayout);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
connect(m_fxScene, SIGNAL(showPreview(TFxP)), this, SIGNAL(showPreview(TFxP)));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_fxScene, SIGNAL(doCollapse(const QList<tfxp> &)), this, SIGNAL(doCollapse(const QList<tfxp> &)));</tfxp></tfxp>
|
|
Toshihiro Shimizu |
890ddd |
connect(m_stageScene, SIGNAL(doCollapse(QList<tstageobjectid>)), this, SIGNAL(doCollapse(QList<tstageobjectid>)));</tstageobjectid></tstageobjectid>
|
|
Toshihiro Shimizu |
890ddd |
connect(m_fxScene, SIGNAL(doExplodeChild(const QList<tfxp> &)), this, SIGNAL(doExplodeChild(const QList<tfxp> &)));</tfxp></tfxp>
|
|
Toshihiro Shimizu |
890ddd |
connect(m_stageScene, SIGNAL(doExplodeChild(QList<tstageobjectid>)), this, SIGNAL(doExplodeChild(QList<tstageobjectid>)));</tstageobjectid></tstageobjectid>
|
|
Toshihiro Shimizu |
890ddd |
connect(m_stageScene, SIGNAL(editObject()), this, SIGNAL(editObject()));
|
|
Toshihiro Shimizu |
890ddd |
connect(m_fxScene, SIGNAL(editObject()), this, SIGNAL(editObject()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->setScene(m_stageScene);
|
|
Toshihiro Shimizu |
890ddd |
m_fxToolbar->hide();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
setFocusProxy(m_viewer);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
SchematicViewer::~SchematicViewer()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicViewer::setApplication(TApplication *app)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_stageScene->setXsheetHandle(app->getCurrentXsheet());
|
|
Toshihiro Shimizu |
890ddd |
m_stageScene->setObjectHandle(app->getCurrentObject());
|
|
Toshihiro Shimizu |
890ddd |
m_stageScene->setFxHandle(app->getCurrentFx());
|
|
Toshihiro Shimizu |
890ddd |
m_stageScene->setColumnHandle(app->getCurrentColumn());
|
|
Toshihiro Shimizu |
890ddd |
m_stageScene->setSceneHandle(app->getCurrentScene());
|
|
Toshihiro Shimizu |
890ddd |
m_stageScene->setFrameHandle(app->getCurrentFrame());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_fxScene->setApplication(app);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicViewer::updateSchematic()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_stageScene->updateScene();
|
|
Toshihiro Shimizu |
890ddd |
m_fxScene->updateScene();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicViewer::setSchematicScene(SchematicScene *scene)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (scene) {
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->setScene(scene);
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->centerOn(scene->sceneRect().center());
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicViewer::createToolbars()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
// Initialize them
|
|
Toshihiro Shimizu |
890ddd |
m_stageToolbar->setMovable(false);
|
|
Toshihiro Shimizu |
890ddd |
m_stageToolbar->setIconSize(QSize(23, 17));
|
|
Toshihiro Shimizu |
890ddd |
m_stageToolbar->setLayoutDirection(Qt::RightToLeft);
|
|
Toshihiro Shimizu |
890ddd |
m_stageToolbar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_commonToolbar->setMovable(false);
|
|
Toshihiro Shimizu |
890ddd |
m_commonToolbar->setIconSize(QSize(23, 17));
|
|
Toshihiro Shimizu |
890ddd |
m_commonToolbar->setLayoutDirection(Qt::RightToLeft);
|
|
Toshihiro Shimizu |
890ddd |
m_commonToolbar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_fxToolbar->setMovable(false);
|
|
Toshihiro Shimizu |
890ddd |
m_fxToolbar->setIconSize(QSize(23, 17));
|
|
Toshihiro Shimizu |
890ddd |
m_fxToolbar->setLayoutDirection(Qt::RightToLeft);
|
|
Toshihiro Shimizu |
890ddd |
m_fxToolbar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_swapToolbar->setMovable(false);
|
|
Toshihiro Shimizu |
890ddd |
m_swapToolbar->setIconSize(QSize(23, 17));
|
|
Toshihiro Shimizu |
890ddd |
m_swapToolbar->setLayoutDirection(Qt::RightToLeft);
|
|
Toshihiro Shimizu |
890ddd |
m_swapToolbar->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicViewer::createActions()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
// Create all actions
|
|
Toshihiro Shimizu |
890ddd |
QAction *addPegbar = 0, *addSpline = 0, *addCamera = 0,
|
|
shun_iwasawa |
22eaa4 |
*insertFx = 0, *addOutputFx = 0, *switchPort = 0;
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
// Fit schematic
|
|
Toshihiro Shimizu |
890ddd |
QIcon fitSchematicIcon = createQIconOnOffPNG("fit", false);
|
|
Toshihiro Shimizu |
890ddd |
m_fitSchematic = new QAction(fitSchematicIcon, tr("&Fit to Window"), m_commonToolbar);
|
|
Toshihiro Shimizu |
890ddd |
connect(m_fitSchematic, SIGNAL(triggered()), m_viewer, SLOT(fitScene()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Center On
|
|
Toshihiro Shimizu |
890ddd |
QIcon centerOnIcon = createQIconOnOffPNG("centerselection", false);
|
|
Toshihiro Shimizu |
890ddd |
m_centerOn = new QAction(centerOnIcon, tr("&Focus on Current"), m_commonToolbar);
|
|
Toshihiro Shimizu |
890ddd |
connect(m_centerOn, SIGNAL(triggered()), m_viewer, SLOT(centerOnCurrent()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Reorder schematic
|
|
Toshihiro Shimizu |
890ddd |
QIcon reorderIcon = createQIconOnOffPNG("reorder", false);
|
|
Toshihiro Shimizu |
890ddd |
m_reorder = new QAction(reorderIcon, tr("&Reorder Nodes"), m_commonToolbar);
|
|
Toshihiro Shimizu |
890ddd |
connect(m_reorder, SIGNAL(triggered()), m_viewer, SLOT(reorderScene()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//Normalize schematic schematic
|
|
Toshihiro Shimizu |
890ddd |
QIcon normalizeIcon = createQIconOnOffPNG("resetsize", false);
|
|
Toshihiro Shimizu |
890ddd |
m_normalize = new QAction(normalizeIcon, tr("&Reset Size"), m_commonToolbar);
|
|
Toshihiro Shimizu |
890ddd |
connect(m_normalize, SIGNAL(triggered()), m_viewer, SLOT(normalizeScene()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QIcon nodeSizeIcon = createQIconOnOffPNG(m_maximizedNode ? "minimizenodes" : "maximizenodes", false);
|
|
Toshihiro Shimizu |
890ddd |
m_nodeSize = new QAction(nodeSizeIcon, m_maximizedNode ? tr("&Minimize Nodes") : tr("&Maximize Nodes"), m_commonToolbar);
|
|
Toshihiro Shimizu |
890ddd |
connect(m_nodeSize, SIGNAL(triggered()), this, SLOT(changeNodeSize()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_fullSchematic) {
|
|
Toshihiro Shimizu |
890ddd |
// AddPegbar
|
|
Toshihiro Shimizu |
890ddd |
addPegbar = new QAction(tr("&New Pegbar"), m_stageToolbar);
|
|
Toshihiro Shimizu |
890ddd |
QIcon addPegbarIcon = createQIconOnOffPNG("pegbar", false);
|
|
Toshihiro Shimizu |
890ddd |
addPegbar->setIcon(addPegbarIcon);
|
|
Toshihiro Shimizu |
890ddd |
connect(addPegbar, SIGNAL(triggered()), m_stageScene, SLOT(onPegbarAdded()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// AddCamera
|
|
Toshihiro Shimizu |
890ddd |
addCamera = new QAction(tr("&New Camera"), m_stageToolbar);
|
|
Toshihiro Shimizu |
890ddd |
QIcon addCameraIcon = createQIconOnOffPNG("camera", false);
|
|
Toshihiro Shimizu |
890ddd |
addCamera->setIcon(addCameraIcon);
|
|
Toshihiro Shimizu |
890ddd |
connect(addCamera, SIGNAL(triggered()), m_stageScene, SLOT(onCameraAdded()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// AddSpline
|
|
Toshihiro Shimizu |
890ddd |
addSpline = new QAction(tr("&New Motion Path"), m_stageToolbar);
|
|
Toshihiro Shimizu |
890ddd |
QIcon addSplineIcon = createQIconOnOffPNG("motionpath", false);
|
|
Toshihiro Shimizu |
890ddd |
addSpline->setIcon(addSplineIcon);
|
|
Toshihiro Shimizu |
890ddd |
connect(addSpline, SIGNAL(triggered()), m_stageScene, SLOT(onSplineAdded()));
|
|
Toshihiro Shimizu |
890ddd |
|
|
shun_iwasawa |
22eaa4 |
//Switch display of stage schematic's output port
|
|
shun_iwasawa |
22eaa4 |
switchPort = new QAction(tr("&Swtich output port display mode"), m_stageToolbar);
|
|
shun_iwasawa |
22eaa4 |
switchPort->setCheckable(true);
|
|
shun_iwasawa |
22eaa4 |
switchPort->setChecked(m_stageScene->isShowLetterOnPortFlagEnabled());
|
|
shun_iwasawa |
22eaa4 |
QIcon switchPortIcon = createQIconOnOffPNG("switchport");
|
|
shun_iwasawa |
22eaa4 |
switchPort->setIcon(switchPortIcon);
|
|
shun_iwasawa |
22eaa4 |
connect(switchPort, SIGNAL(toggled(bool)), m_stageScene, SLOT(onSwitchPortModeToggled(bool)));
|
|
shun_iwasawa |
22eaa4 |
|
|
Toshihiro Shimizu |
890ddd |
// InsertFx
|
|
Toshihiro Shimizu |
890ddd |
insertFx = CommandManager::instance()->getAction("MI_InsertFx");
|
|
Toshihiro Shimizu |
890ddd |
if (insertFx) {
|
|
Toshihiro Shimizu |
890ddd |
QIcon insertFxIcon = createQIconOnOffPNG("fx", false);
|
|
Toshihiro Shimizu |
890ddd |
insertFx->setIcon(insertFxIcon);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// AddOutputFx
|
|
Toshihiro Shimizu |
890ddd |
addOutputFx = CommandManager::instance()->getAction("MI_NewOutputFx");
|
|
Toshihiro Shimizu |
890ddd |
QIcon addOutputFxIcon = createQIconOnOffPNG("output", false);
|
|
Toshihiro Shimizu |
890ddd |
if (addOutputFx)
|
|
Toshihiro Shimizu |
890ddd |
addOutputFx->setIcon(addOutputFxIcon);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Swap fx/stage schematic
|
|
Toshihiro Shimizu |
890ddd |
QIcon changeSchematicIcon = createQIconOnOffPNG("swap", false);
|
|
Toshihiro Shimizu |
890ddd |
m_changeScene = CommandManager::instance()->getAction("A_FxSchematicToggle", true);
|
|
Toshihiro Shimizu |
890ddd |
if (m_changeScene) {
|
|
Toshihiro Shimizu |
890ddd |
m_changeScene->setIcon(changeSchematicIcon);
|
|
Toshihiro Shimizu |
890ddd |
connect(m_changeScene, SIGNAL(triggered()), this, SLOT(onSceneChanged()));
|
|
Toshihiro Shimizu |
890ddd |
} else
|
|
Toshihiro Shimizu |
890ddd |
m_changeScene = 0;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// Add actions to toolbars (in reverse)
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_commonToolbar->addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
m_commonToolbar->addAction(m_nodeSize);
|
|
Toshihiro Shimizu |
890ddd |
m_commonToolbar->addAction(m_normalize);
|
|
Toshihiro Shimizu |
890ddd |
m_commonToolbar->addAction(m_reorder);
|
|
Toshihiro Shimizu |
890ddd |
m_commonToolbar->addAction(m_centerOn);
|
|
Toshihiro Shimizu |
890ddd |
m_commonToolbar->addAction(m_fitSchematic);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_fullSchematic) {
|
|
Toshihiro Shimizu |
890ddd |
m_stageToolbar->addSeparator();
|
|
shun_iwasawa |
22eaa4 |
m_stageToolbar->addAction(switchPort);
|
|
shun_iwasawa |
22eaa4 |
m_stageToolbar->addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
m_stageToolbar->addAction(addSpline);
|
|
Toshihiro Shimizu |
890ddd |
m_stageToolbar->addAction(addCamera);
|
|
Toshihiro Shimizu |
890ddd |
m_stageToolbar->addAction(addPegbar);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_fxToolbar->addSeparator();
|
|
Toshihiro Shimizu |
890ddd |
m_fxToolbar->addAction(addOutputFx);
|
|
Toshihiro Shimizu |
890ddd |
m_fxToolbar->addAction(insertFx);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (m_changeScene)
|
|
Toshihiro Shimizu |
890ddd |
m_swapToolbar->addAction(m_changeScene);
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicViewer::setStageSchematic()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewer->scene() != m_stageScene) {
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->setScene(m_stageScene);
|
|
Toshihiro Shimizu |
890ddd |
QRectF rect = m_stageScene->itemsBoundingRect();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->resetMatrix();
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->centerOn(rect.center());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_fxToolbar->hide();
|
|
Toshihiro Shimizu |
890ddd |
m_stageToolbar->show();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
parentWidget()->setWindowTitle(QObject::tr("Stage Schematic"));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicViewer::setFxSchematic()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewer->scene() != m_fxScene) {
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->setScene(m_fxScene);
|
|
Toshihiro Shimizu |
890ddd |
QRectF rect = m_fxScene->itemsBoundingRect();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->resetMatrix();
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->centerOn(rect.center());
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_stageToolbar->hide();
|
|
Toshihiro Shimizu |
890ddd |
m_fxToolbar->show();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//check if the fx scene was small scaled (icon view mode)
|
|
Toshihiro Shimizu |
890ddd |
if (!m_fxScene->isLargeScaled())
|
|
Toshihiro Shimizu |
890ddd |
m_fxScene->updateScene();
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
parentWidget()->setWindowTitle(QObject::tr("FX Schematic"));
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicViewer::onSceneChanged()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!hasFocus())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
QGraphicsScene *scene = m_viewer->scene();
|
|
Toshihiro Shimizu |
890ddd |
if (scene == m_fxScene)
|
|
Toshihiro Shimizu |
890ddd |
setStageSchematic();
|
|
Toshihiro Shimizu |
890ddd |
else if (scene == m_stageScene)
|
|
Toshihiro Shimizu |
890ddd |
setFxSchematic();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicViewer::onSceneSwitched()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_maximizedNode = m_fxScene->getXsheetHandle()->getXsheet()->getFxDag()->getDagGridDimension() == 0;
|
|
Toshihiro Shimizu |
890ddd |
QIcon nodeSizeIcon = createQIconOnOffPNG(m_maximizedNode ? "minimizenodes" : "maximizenodes", false);
|
|
Toshihiro Shimizu |
890ddd |
m_nodeSize->setIcon(nodeSizeIcon);
|
|
Toshihiro Shimizu |
890ddd |
QString label(m_maximizedNode ? tr("&Minimize Nodes") : tr("&Maximize Nodes"));
|
|
Toshihiro Shimizu |
890ddd |
m_nodeSize->setText(label);
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
// reset schematic
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->resetMatrix();
|
|
Toshihiro Shimizu |
890ddd |
m_viewer->centerOn(m_viewer->scene()->itemsBoundingRect().center());
|
|
Toshihiro Shimizu |
890ddd |
if (m_viewer->scene() == m_fxScene && !m_fxScene->isLargeScaled())
|
|
Toshihiro Shimizu |
890ddd |
m_fxScene->updateScene();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
bool SchematicViewer::isStageSchematicViewed()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
QGraphicsScene *scene = m_viewer->scene();
|
|
Toshihiro Shimizu |
890ddd |
return scene == m_stageScene;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicViewer::setStageSchematicViewed(bool isStageSchematic)
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
if (!m_fullSchematic)
|
|
Toshihiro Shimizu |
890ddd |
isStageSchematic = true;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
if (isStageSchematic == isStageSchematicViewed())
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
if (isStageSchematic)
|
|
Toshihiro Shimizu |
890ddd |
setStageSchematic();
|
|
Toshihiro Shimizu |
890ddd |
else
|
|
Toshihiro Shimizu |
890ddd |
setFxSchematic();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicViewer::updateScenes()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
TStageObjectId id = m_stageScene->getCurrentObject();
|
|
Toshihiro Shimizu |
890ddd |
if (id.isColumn()) {
|
|
Toshihiro Shimizu |
890ddd |
m_stageScene->update();
|
|
Toshihiro Shimizu |
890ddd |
TXsheet *xsh = m_stageScene->getXsheetHandle()->getXsheet();
|
|
Toshihiro Shimizu |
890ddd |
if (!xsh)
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
TXshColumn *column = xsh->getColumn(id.getIndex());
|
|
Toshihiro Shimizu |
890ddd |
if (!column) {
|
|
Toshihiro Shimizu |
890ddd |
m_fxScene->getFxHandle()->setFx(0, false);
|
|
Toshihiro Shimizu |
890ddd |
return;
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
TFx *fx = column->getFx();
|
|
Toshihiro Shimizu |
890ddd |
m_fxScene->getFxHandle()->setFx(fx, false);
|
|
Toshihiro Shimizu |
890ddd |
m_fxScene->update();
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//------------------------------------------------------------------
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
void SchematicViewer::changeNodeSize()
|
|
Toshihiro Shimizu |
890ddd |
{
|
|
Toshihiro Shimizu |
890ddd |
m_maximizedNode = !m_maximizedNode;
|
|
Toshihiro Shimizu |
890ddd |
//aggiono l'icona del pulsante;
|
|
Toshihiro Shimizu |
890ddd |
m_fxScene->resizeNodes(m_maximizedNode);
|
|
Toshihiro Shimizu |
890ddd |
m_stageScene->resizeNodes(m_maximizedNode);
|
|
Toshihiro Shimizu |
890ddd |
QIcon nodeSizeIcon = createQIconOnOffPNG(m_maximizedNode ? "minimizenodes" : "maximizenodes", false);
|
|
Toshihiro Shimizu |
890ddd |
m_nodeSize->setIcon(nodeSizeIcon);
|
|
Toshihiro Shimizu |
890ddd |
QString label(m_maximizedNode ? tr("&Minimize Nodes") : tr("&Maximize Nodes"));
|
|
Toshihiro Shimizu |
890ddd |
m_nodeSize->setText(label);
|
|
Toshihiro Shimizu |
890ddd |
}
|