1
/*******************************************************************
3
Part of the Fritzing project - http://fritzing.org
4
Copyright (c) 2007-2010 Fachhochschule Potsdam - http://fh-potsdam.de
6
Fritzing is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
11
Fritzing is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with Fritzing. If not, see <http://www.gnu.org/licenses/>.
19
********************************************************************
22
$Author: cohen@irascible.com $:
23
$Date: 2010-05-27 23:36:01 +0200 (Thu, 27 May 2010) $
25
********************************************************************/
28
#ifndef PARTSEDITORCONNECTORSCONNECTORITEM_H_
29
#define PARTSEDITORCONNECTORSCONNECTORITEM_H_
31
#include "partseditorconnectoritem.h"
33
class PartsEditorConnectorsConnectorItem : public PartsEditorConnectorItem {
37
PartsEditorConnectorsConnectorItem(Connector * conn, ItemBase* attachedTo, bool showingTerminalPoint);
38
PartsEditorConnectorsConnectorItem(Connector * conn, ItemBase* attachedTo, bool showingTerminalPoint, const QRectF &bounds);
39
~PartsEditorConnectorsConnectorItem();
41
void highlight(const QString &connId);
42
void setConnector(Connector *connector);
43
void setMismatching(bool isMismatching);
45
void setShowTerminalPoint(bool show);
46
bool isShowingTerminalPoint();
47
void setTerminalPoint(QPointF);
48
void updateTerminalPoint();
49
TerminalPointItem *terminalPointItem();
56
bool hasBeenMoved() const;
57
bool hasBeenResized() const;
58
QPointF initialPos() const;
61
void isResizableSlot(bool & resizable);
62
void resizeSlot(qreal x1, qreal y1, qreal x2, qreal y2);
63
void createTerminalPoint();
66
void init(bool resizable);
67
void mousePressEvent(QGraphicsSceneMouseEvent *event);
68
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
70
void resizeRect(qreal x, qreal y, qreal width, qreal height);
71
void setResizable(bool resizable);
73
void showErrorIcon(bool showIt);
74
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
75
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
77
void drawDottedRect(QPainter *painter, const QColor &color1, const QColor &color2, const QRectF &rect);
79
Qt::Orientations orientation, QPainter *painter, const QPen &pen1, const QPen &pen2,
80
qreal pos1, qreal pos2, qreal fixedAxis, const QPen &lastUsedPen = QPen()
82
QPen drawDottedLineAux(
83
Qt::Orientations orientation, QPainter *painter, const QPen &firstPen, const QPen &secondPen,
84
qreal pos, qreal fixedAxis, qreal dotSize, int dotCount
88
void doPrepareGeometryChange();
90
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
91
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
93
void paintErrorIcon(QPainter *painter);
94
TerminalPointItem* newTerminalPointItem();
97
bool m_showingTerminalPoint; // important only if m_showsTerminalPoints == true
98
TerminalPointItem *m_terminalPointItem;
100
QRectF m_resizedRect;
101
bool m_geometryHasChanged;
102
bool m_geometryHasChangedAlLeastOnce;
103
bool m_inFileDefined;
105
class ConnectorRectangle *m_handlers;
108
QPointF m_initialPos;
110
static qreal MinWidth;
111
static qreal MinHeight;
114
#endif /* PARTSEDITORCONNECTORSCONNECTORITEM_H_ */
1
/*******************************************************************
3
Part of the Fritzing project - http://fritzing.org
4
Copyright (c) 2007-2011 Fachhochschule Potsdam - http://fh-potsdam.de
6
Fritzing is free software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
11
Fritzing is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with Fritzing. If not, see <http://www.gnu.org/licenses/>.
19
********************************************************************
22
$Author: cohen@irascible.com $:
23
$Date: 2011-07-30 21:17:22 +0200 (Sat, 30 Jul 2011) $
25
********************************************************************/
28
#ifndef PARTSEDITORCONNECTORSCONNECTORITEM_H_
29
#define PARTSEDITORCONNECTORSCONNECTORITEM_H_
31
#include "partseditorconnectoritem.h"
33
class PartsEditorConnectorsConnectorItem : public PartsEditorConnectorItem {
37
PartsEditorConnectorsConnectorItem(Connector * conn, ItemBase* attachedTo, bool showingTerminalPoint);
38
PartsEditorConnectorsConnectorItem(Connector * conn, ItemBase* attachedTo, bool showingTerminalPoint, const QRectF &bounds);
39
~PartsEditorConnectorsConnectorItem();
41
void highlight(const QString &connId);
42
void setConnector(Connector *connector);
43
void setMismatching(bool isMismatching);
45
void setShowTerminalPoint(bool show);
46
bool isShowingTerminalPoint();
47
void setTerminalPoint(QPointF);
48
void updateTerminalPoint();
49
TerminalPointItem *terminalPointItem();
56
bool hasBeenMoved() const;
57
bool hasBeenResized() const;
58
QPointF initialPos() const;
61
void isResizableSlot(bool & resizable);
62
void resizeSlot(double x1, double y1, double x2, double y2);
63
void createTerminalPoint();
66
void init(bool resizable);
67
void mousePressEvent(QGraphicsSceneMouseEvent *event);
68
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
70
void resizeRect(double x, double y, double width, double height);
71
void setResizable(bool resizable);
73
void showErrorIcon(bool showIt);
74
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
75
QVariant itemChange(GraphicsItemChange change, const QVariant &value);
77
void drawDottedRect(QPainter *painter, const QColor &color1, const QColor &color2, const QRectF &rect);
79
Qt::Orientations orientation, QPainter *painter, const QPen &pen1, const QPen &pen2,
80
double pos1, double pos2, double fixedAxis, const QPen &lastUsedPen = QPen()
82
QPen drawDottedLineAux(
83
Qt::Orientations orientation, QPainter *painter, const QPen &firstPen, const QPen &secondPen,
84
double pos, double fixedAxis, double dotSize, int dotCount
88
void doPrepareGeometryChange();
90
void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
91
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
93
void paintErrorIcon(QPainter *painter);
94
TerminalPointItem* newTerminalPointItem();
97
bool m_showingTerminalPoint; // important only if m_showsTerminalPoints == true
98
TerminalPointItem *m_terminalPointItem;
100
QRectF m_resizedRect;
101
bool m_geometryHasChanged;
102
bool m_geometryHasChangedAlLeastOnce;
103
bool m_inFileDefined;
105
class ConnectorRectangle *m_handlers;
108
QPointF m_initialPos;
110
static double MinWidth;
111
static double MinHeight;
114
#endif /* PARTSEDITORCONNECTORSCONNECTORITEM_H_ */