From 59eee652c5fea36945a4a8ce2936843bd90d0e1b Mon Sep 17 00:00:00 2001 From: Aleks Kissinger Date: Fri, 20 Jul 2018 11:01:34 +0200 Subject: ... --- src/gui/tikzscene.h | 214 ++++++++++++++++++++++++++-------------------------- 1 file changed, 107 insertions(+), 107 deletions(-) (limited to 'src/gui/tikzscene.h') diff --git a/src/gui/tikzscene.h b/src/gui/tikzscene.h index 4ac56c7..8aafe28 100644 --- a/src/gui/tikzscene.h +++ b/src/gui/tikzscene.h @@ -1,107 +1,107 @@ -/* - TikZiT - a GUI diagram editor for TikZ - Copyright (C) 2018 Aleks Kissinger - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ - -/*! - * Manage the scene, which contains a single Graph, and respond to user input. This serves as - * the controller for the MVC (TikzDocument, TikzView, TikzScene). - */ - -#ifndef TIKZSCENE_H -#define TIKZSCENE_H - -#include "graph.h" -#include "nodeitem.h" -#include "edgeitem.h" -#include "tikzdocument.h" -#include "toolpalette.h" -#include "stylepalette.h" - -#include -#include -#include -#include -#include -#include -#include - -class TikzScene : public QGraphicsScene -{ - Q_OBJECT -public: - TikzScene(TikzDocument *tikzDocument, ToolPalette *tools, StylePalette *styles, QObject *parent); - ~TikzScene(); - Graph *graph(); - QMap &nodeItems(); - QMap &edgeItems(); - void refreshAdjacentEdges(QList nodes); -// void setBounds(QRectF bounds); - - TikzDocument *tikzDocument() const; - void setTikzDocument(TikzDocument *tikzDocument); - void reloadStyles(); - //void refreshSceneBounds(); - void applyActiveStyleToNodes(); - void deleteSelectedItems(); - void copyToClipboard(); - void cutToClipboard(); - void pasteFromClipboard(); - void selectAllNodes(); - void deselectAll(); - void parseTikz(QString tikz); - bool enabled() const; - void setEnabled(bool enabled); - int lineNumberForSelection(); - - - void getSelection(QSet &selNodes, QSet &selEdges); - QSet getSelectedNodes(); - -public slots: - void graphReplaced(); - -protected: - void mousePressEvent(QGraphicsSceneMouseEvent *event) override; - void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; - void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; - void keyReleaseEvent(QKeyEvent *event) override; - void keyPressEvent(QKeyEvent *event) override; - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override; -private: - TikzDocument *_tikzDocument; - ToolPalette *_tools; - StylePalette *_styles; - QMap _nodeItems; - QMap _edgeItems; - QGraphicsLineItem *_drawEdgeItem; - QGraphicsRectItem *_rubberBandItem; - EdgeItem *_modifyEdgeItem; - NodeItem *_edgeStartNodeItem; - NodeItem *_edgeEndNodeItem; - bool _firstControlPoint; - QPointF _mouseDownPos; - bool _draggingNodes; - - QMap _oldNodePositions; - float _oldWeight; - int _oldBend; - int _oldInAngle; - int _oldOutAngle; - bool _enabled; -}; - -#endif // TIKZSCENE_H +/* + TikZiT - a GUI diagram editor for TikZ + Copyright (C) 2018 Aleks Kissinger + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/*! + * Manage the scene, which contains a single Graph, and respond to user input. This serves as + * the controller for the MVC (TikzDocument, TikzView, TikzScene). + */ + +#ifndef TIKZSCENE_H +#define TIKZSCENE_H + +#include "graph.h" +#include "nodeitem.h" +#include "edgeitem.h" +#include "tikzdocument.h" +#include "toolpalette.h" +#include "stylepalette.h" + +#include +#include +#include +#include +#include +#include +#include + +class TikzScene : public QGraphicsScene +{ + Q_OBJECT +public: + TikzScene(TikzDocument *tikzDocument, ToolPalette *tools, StylePalette *styles, QObject *parent); + ~TikzScene(); + Graph *graph(); + QMap &nodeItems(); + QMap &edgeItems(); + void refreshAdjacentEdges(QList nodes); +// void setBounds(QRectF bounds); + + TikzDocument *tikzDocument() const; + void setTikzDocument(TikzDocument *tikzDocument); + void reloadStyles(); + //void refreshSceneBounds(); + void applyActiveStyleToNodes(); + void deleteSelectedItems(); + void copyToClipboard(); + void cutToClipboard(); + void pasteFromClipboard(); + void selectAllNodes(); + void deselectAll(); + void parseTikz(QString tikz); + bool enabled() const; + void setEnabled(bool enabled); + int lineNumberForSelection(); + + + void getSelection(QSet &selNodes, QSet &selEdges); + QSet getSelectedNodes(); + +public slots: + void graphReplaced(); + +protected: + void mousePressEvent(QGraphicsSceneMouseEvent *event) override; + void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override; + void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override; + void keyReleaseEvent(QKeyEvent *event) override; + void keyPressEvent(QKeyEvent *event) override; + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override; +private: + TikzDocument *_tikzDocument; + ToolPalette *_tools; + StylePalette *_styles; + QMap _nodeItems; + QMap _edgeItems; + QGraphicsLineItem *_drawEdgeItem; + QGraphicsRectItem *_rubberBandItem; + EdgeItem *_modifyEdgeItem; + NodeItem *_edgeStartNodeItem; + NodeItem *_edgeEndNodeItem; + bool _firstControlPoint; + QPointF _mouseDownPos; + bool _draggingNodes; + + QMap _oldNodePositions; + float _oldWeight; + int _oldBend; + int _oldInAngle; + int _oldOutAngle; + bool _enabled; +}; + +#endif // TIKZSCENE_H -- cgit v1.2.3