102 lines
2.5 KiB
C++
102 lines
2.5 KiB
C++
/*
|
|
QAD - Qt ADvanced
|
|
|
|
Ivan Pelipenko peri4ko@yandex.ru, Andrey Bychkov work.a.b@yandex.ru
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Lesser 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 Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef BLOCKBASE_H
|
|
#define BLOCKBASE_H
|
|
|
|
#include <QGraphicsView>
|
|
#include <QGraphicsScene>
|
|
#include <QGraphicsItem>
|
|
#include <QGraphicsObject>
|
|
#include <QGraphicsEllipseItem>
|
|
#include <QGraphicsSceneHoverEvent>
|
|
#include <QGraphicsSceneMouseEvent>
|
|
#include <QStack>
|
|
#include "qad_types.h"
|
|
#include "qad_blockview_export.h"
|
|
|
|
|
|
/// data:
|
|
/// 1002 - flag for move parent (true)
|
|
/// 1003 - flag for visualize selection (true)
|
|
/// 1004 - BlockItemPin ("pin")
|
|
/// 1005 - BlockBusItem ("connection")
|
|
/// 1006 - BlockItem ("item")
|
|
/// 1007 - BlockItem selection (true)
|
|
/// 1008 - item is NOT decor, ignore for function decors() (true)
|
|
/// 1009 - item is scene decor ("decor")
|
|
/// 1010 - BlockItem decor (src text for QGraphicsSimpleTextItem)
|
|
/// 1011 - item is BlockItem decor (true)
|
|
/// 1100 - flag for correct move (true)
|
|
|
|
static const int _blockitem_current_version_ = 1;
|
|
|
|
|
|
enum BlockviewItemData {
|
|
bvidSelected = 1000, // bool
|
|
bvidItemPos = 1001, // QpointF
|
|
bvidMoveParent = 1002, // bool
|
|
bvidVisualizeSelection = 1003, // bool
|
|
bvidType = 1005, // BlockviewItemType
|
|
bvidInvalidItem = 1008, // bool
|
|
bvidDecorText = 1010, // QString
|
|
bvidBlockDecor = 1011, // bool
|
|
bvidDTHandle = 1012, // bool
|
|
bvidCorrectMove = 1100, // bool
|
|
};
|
|
|
|
enum BlockviewItemType {
|
|
bvitPin,
|
|
bvitBus,
|
|
bvitBlock,
|
|
bvitSelection,
|
|
bvitDecor,
|
|
bvitItemText,
|
|
};
|
|
|
|
QAD_BLOCKVIEW_EXPORT QDataStream & operator <<(QDataStream & s, const QGraphicsItem * item);
|
|
QAD_BLOCKVIEW_EXPORT QDataStream & operator >>(QDataStream & s, QGraphicsItem *& item);
|
|
|
|
|
|
class QAD_BLOCKVIEW_EXPORT BlockItemBase: public QObject
|
|
{
|
|
Q_OBJECT
|
|
Q_ENUMS(Action)
|
|
public:
|
|
|
|
enum Action {
|
|
BlockAdd = 1,
|
|
BlockMove,
|
|
BlockRemove,
|
|
BlockCopy,
|
|
BusAdd,
|
|
BusRemove,
|
|
BusPointAdd,
|
|
BusPointMove,
|
|
BusPointRemove,
|
|
BusSegmentAdd,
|
|
BusSegmentMove,
|
|
BusSegmentRemove,
|
|
Paste
|
|
};
|
|
|
|
};
|
|
|
|
#endif // BLOCKBASE_H
|