~ubuntu-branches/ubuntu/precise/fritzing/precise

« back to all changes in this revision

Viewing changes to src/partseditor/partseditorconnectorsconnectoritem.h

  • Committer: Bazaar Package Importer
  • Author(s): Georges Khaznadar
  • Date: 2011-08-26 10:11:05 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20110826101105-w5hmn7zcf93ig5v6
Tags: 0.6.3b-1
* upgrapded to the newer upstream version
* parameters of the function GraphicsUtils::distanceFromLine in 
  src/svg/groundplanegenerator.cpp:767 are now declared as doubles,
  which Closes: #636441
* the new version fixes src/utils/folderutils.cpp, which
  Closes: #636061

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*******************************************************************
2
 
 
3
 
Part of the Fritzing project - http://fritzing.org
4
 
Copyright (c) 2007-2010 Fachhochschule Potsdam - http://fh-potsdam.de
5
 
 
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.
10
 
 
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.
15
 
 
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/>.
18
 
 
19
 
********************************************************************
20
 
 
21
 
$Revision: 4200 $:
22
 
$Author: cohen@irascible.com $:
23
 
$Date: 2010-05-27 23:36:01 +0200 (Thu, 27 May 2010) $
24
 
 
25
 
********************************************************************/
26
 
 
27
 
 
28
 
#ifndef PARTSEDITORCONNECTORSCONNECTORITEM_H_
29
 
#define PARTSEDITORCONNECTORSCONNECTORITEM_H_
30
 
 
31
 
#include "partseditorconnectoritem.h"
32
 
 
33
 
class PartsEditorConnectorsConnectorItem : public PartsEditorConnectorItem {
34
 
        Q_OBJECT
35
 
 
36
 
public:
37
 
        PartsEditorConnectorsConnectorItem(Connector * conn, ItemBase* attachedTo, bool showingTerminalPoint);
38
 
        PartsEditorConnectorsConnectorItem(Connector * conn, ItemBase* attachedTo, bool showingTerminalPoint, const QRectF &bounds);
39
 
        ~PartsEditorConnectorsConnectorItem();
40
 
 
41
 
        void highlight(const QString &connId);
42
 
        void setConnector(Connector *connector);
43
 
        void setMismatching(bool isMismatching);
44
 
 
45
 
        void setShowTerminalPoint(bool show);
46
 
        bool isShowingTerminalPoint();
47
 
        void setTerminalPoint(QPointF);
48
 
        void updateTerminalPoint();
49
 
        TerminalPointItem *terminalPointItem();
50
 
 
51
 
        qreal minWidth();
52
 
        qreal minHeight();
53
 
 
54
 
        QRectF mappedRect();
55
 
 
56
 
        bool hasBeenMoved() const;
57
 
        bool hasBeenResized() const;
58
 
        QPointF initialPos() const;
59
 
 
60
 
protected slots:
61
 
        void isResizableSlot(bool & resizable);
62
 
        void resizeSlot(qreal x1, qreal y1, qreal x2, qreal y2);
63
 
        void createTerminalPoint();
64
 
 
65
 
protected:
66
 
        void init(bool resizable);
67
 
        void mousePressEvent(QGraphicsSceneMouseEvent *event);
68
 
        void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
69
 
 
70
 
        void resizeRect(qreal x, qreal y, qreal width, qreal height);
71
 
        void setResizable(bool resizable);
72
 
 
73
 
        void showErrorIcon(bool showIt);
74
 
        void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
75
 
        QVariant itemChange(GraphicsItemChange change, const QVariant &value);
76
 
 
77
 
        void drawDottedRect(QPainter *painter, const QColor &color1, const QColor &color2, const QRectF &rect);
78
 
        QPen drawDottedLine(
79
 
                Qt::Orientations orientation, QPainter *painter, const QPen &pen1, const QPen &pen2,
80
 
                qreal pos1, qreal pos2, qreal fixedAxis, const QPen &lastUsedPen = QPen()
81
 
        );
82
 
        QPen drawDottedLineAux(
83
 
                Qt::Orientations orientation, QPainter *painter, const QPen &firstPen, const QPen &secondPen,
84
 
                qreal pos, qreal fixedAxis, qreal dotSize, int dotCount
85
 
        );
86
 
 
87
 
        void informChange();
88
 
        void doPrepareGeometryChange();
89
 
 
90
 
        void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
91
 
        void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
92
 
 
93
 
        void paintErrorIcon(QPainter *painter);
94
 
        TerminalPointItem* newTerminalPointItem();
95
 
 
96
 
        bool m_showErrorIcon;
97
 
        bool m_showingTerminalPoint; // important only if m_showsTerminalPoints == true
98
 
        TerminalPointItem *m_terminalPointItem;
99
 
 
100
 
        QRectF m_resizedRect;
101
 
        bool m_geometryHasChanged;
102
 
        bool m_geometryHasChangedAlLeastOnce;
103
 
        bool m_inFileDefined;
104
 
 
105
 
        class ConnectorRectangle *m_handlers;
106
 
        bool m_resizable;
107
 
        bool m_resized;
108
 
        QPointF m_initialPos;
109
 
 
110
 
        static qreal MinWidth;
111
 
        static qreal MinHeight;
112
 
};
113
 
 
114
 
#endif /* PARTSEDITORCONNECTORSCONNECTORITEM_H_ */
 
1
/*******************************************************************
 
2
 
 
3
Part of the Fritzing project - http://fritzing.org
 
4
Copyright (c) 2007-2011 Fachhochschule Potsdam - http://fh-potsdam.de
 
5
 
 
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.
 
10
 
 
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.
 
15
 
 
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/>.
 
18
 
 
19
********************************************************************
 
20
 
 
21
$Revision: 5309 $:
 
22
$Author: cohen@irascible.com $:
 
23
$Date: 2011-07-30 21:17:22 +0200 (Sat, 30 Jul 2011) $
 
24
 
 
25
********************************************************************/
 
26
 
 
27
 
 
28
#ifndef PARTSEDITORCONNECTORSCONNECTORITEM_H_
 
29
#define PARTSEDITORCONNECTORSCONNECTORITEM_H_
 
30
 
 
31
#include "partseditorconnectoritem.h"
 
32
 
 
33
class PartsEditorConnectorsConnectorItem : public PartsEditorConnectorItem {
 
34
        Q_OBJECT
 
35
 
 
36
public:
 
37
        PartsEditorConnectorsConnectorItem(Connector * conn, ItemBase* attachedTo, bool showingTerminalPoint);
 
38
        PartsEditorConnectorsConnectorItem(Connector * conn, ItemBase* attachedTo, bool showingTerminalPoint, const QRectF &bounds);
 
39
        ~PartsEditorConnectorsConnectorItem();
 
40
 
 
41
        void highlight(const QString &connId);
 
42
        void setConnector(Connector *connector);
 
43
        void setMismatching(bool isMismatching);
 
44
 
 
45
        void setShowTerminalPoint(bool show);
 
46
        bool isShowingTerminalPoint();
 
47
        void setTerminalPoint(QPointF);
 
48
        void updateTerminalPoint();
 
49
        TerminalPointItem *terminalPointItem();
 
50
 
 
51
        double minWidth();
 
52
        double minHeight();
 
53
 
 
54
        QRectF mappedRect();
 
55
 
 
56
        bool hasBeenMoved() const;
 
57
        bool hasBeenResized() const;
 
58
        QPointF initialPos() const;
 
59
 
 
60
protected slots:
 
61
        void isResizableSlot(bool & resizable);
 
62
        void resizeSlot(double x1, double y1, double x2, double y2);
 
63
        void createTerminalPoint();
 
64
 
 
65
protected:
 
66
        void init(bool resizable);
 
67
        void mousePressEvent(QGraphicsSceneMouseEvent *event);
 
68
        void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
 
69
 
 
70
        void resizeRect(double x, double y, double width, double height);
 
71
        void setResizable(bool resizable);
 
72
 
 
73
        void showErrorIcon(bool showIt);
 
74
        void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
 
75
        QVariant itemChange(GraphicsItemChange change, const QVariant &value);
 
76
 
 
77
        void drawDottedRect(QPainter *painter, const QColor &color1, const QColor &color2, const QRectF &rect);
 
78
        QPen drawDottedLine(
 
79
                Qt::Orientations orientation, QPainter *painter, const QPen &pen1, const QPen &pen2,
 
80
                double pos1, double pos2, double fixedAxis, const QPen &lastUsedPen = QPen()
 
81
        );
 
82
        QPen drawDottedLineAux(
 
83
                Qt::Orientations orientation, QPainter *painter, const QPen &firstPen, const QPen &secondPen,
 
84
                double pos, double fixedAxis, double dotSize, int dotCount
 
85
        );
 
86
 
 
87
        void informChange();
 
88
        void doPrepareGeometryChange();
 
89
 
 
90
        void hoverEnterEvent(QGraphicsSceneHoverEvent *event);
 
91
        void hoverLeaveEvent(QGraphicsSceneHoverEvent *event);
 
92
 
 
93
        void paintErrorIcon(QPainter *painter);
 
94
        TerminalPointItem* newTerminalPointItem();
 
95
 
 
96
        bool m_showErrorIcon;
 
97
        bool m_showingTerminalPoint; // important only if m_showsTerminalPoints == true
 
98
        TerminalPointItem *m_terminalPointItem;
 
99
 
 
100
        QRectF m_resizedRect;
 
101
        bool m_geometryHasChanged;
 
102
        bool m_geometryHasChangedAlLeastOnce;
 
103
        bool m_inFileDefined;
 
104
 
 
105
        class ConnectorRectangle *m_handlers;
 
106
        bool m_resizable;
 
107
        bool m_resized;
 
108
        QPointF m_initialPos;
 
109
 
 
110
        static double MinWidth;
 
111
        static double MinHeight;
 
112
};
 
113
 
 
114
#endif /* PARTSEDITORCONNECTORSCONNECTORITEM_H_ */