~ubuntu-branches/ubuntu/trusty/fritzing/trusty-proposed

« back to all changes in this revision

Viewing changes to src/items/jumperitem.cpp

  • Committer: Package Import Robot
  • Author(s): Enrique Hernández Bello
  • Date: 2012-11-11 21:38:56 UTC
  • mfrom: (1.1.5)
  • Revision ID: package-import@ubuntu.com-20121111213856-0825ywdrtdcshl91
Tags: 0.7.10b-1
* New upstream version. Closes: #661495, #692998
* Removed useless patches.
* Removed SetupAPI.lib from sourceless files.
* Skip dfsg tarball creation if there are no sourceless files.
* Added libqt4-sql-sqlite to dependencies. Thanks to Tom Hummel <tom@bluespice.org>.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
********************************************************************
20
20
 
21
 
$Revision: 6218 $:
22
 
$Author: cohen@irascible.com $:
23
 
$Date: 2012-07-26 10:32:57 +0200 (Thu, 26 Jul 2012) $
 
21
$Revision: 6505 $:
 
22
$Author: irascibl@gmail.com $:
 
23
$Date: 2012-10-03 10:14:52 +0200 (Wed, 03 Oct 2012) $
24
24
 
25
25
********************************************************************/
26
26
 
31
31
#include "../utils/graphicsutils.h"
32
32
#include "../svg/svgfilesplitter.h"
33
33
#include "../sketch/infographicsview.h"
 
34
#include "../debugdialog.h"
34
35
 
35
36
static QString Copper0LayerTemplate = "";
36
37
static QString JumperWireLayerTemplate = "";
68
69
 
69
70
/////////////////////////////////////////////////////////
70
71
 
71
 
JumperItem::JumperItem( ModelPart * modelPart, ViewIdentifierClass::ViewIdentifier viewIdentifier,  const ViewGeometry & viewGeometry, long id, QMenu * itemMenu, bool doLabel) 
 
72
JumperItem::JumperItem( ModelPart * modelPart, ViewLayer::ViewIdentifier viewIdentifier,  const ViewGeometry & viewGeometry, long id, QMenu * itemMenu, bool doLabel) 
72
73
        : PaletteItem(modelPart, viewIdentifier,  viewGeometry,  id, itemMenu, doLabel)
73
74
{
74
75
        if (Colors.isEmpty()) {
100
101
 
101
102
QRectF JumperItem::boundingRect() const
102
103
{
103
 
    if (m_viewIdentifier != ViewIdentifierClass::PCBView) {
 
104
    if (m_viewIdentifier != ViewLayer::PCBView) {
104
105
        return PaletteItem::boundingRect();
105
106
    }
106
107
 
109
110
 
110
111
void JumperItem::paintHover(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
111
112
{
112
 
    if (m_viewIdentifier != ViewIdentifierClass::PCBView) {
 
113
    if (m_viewIdentifier != ViewLayer::PCBView) {
113
114
       PaletteItem::paintHover(painter, option, widget);
114
115
           return;
115
116
    }
119
120
 
120
121
void JumperItem::paintSelected(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
121
122
{
122
 
    if (m_viewIdentifier != ViewIdentifierClass::PCBView) {
 
123
    if (m_viewIdentifier != ViewLayer::PCBView) {
123
124
       PaletteItem::paintSelected(painter, option, widget);
124
125
           return;
125
126
    }
129
130
 
130
131
QPainterPath JumperItem::hoverShape() const
131
132
{
132
 
    if (m_viewIdentifier != ViewIdentifierClass::PCBView) {
 
133
    if (m_viewIdentifier != ViewLayer::PCBView) {
133
134
        return PaletteItem::hoverShape();
134
135
     }
135
136
 
154
155
        return hoverShape();
155
156
}
156
157
 
157
 
bool JumperItem::setUpImage(ModelPart * modelPart, ViewIdentifierClass::ViewIdentifier viewIdentifier, const LayerHash & viewLayers, ViewLayer::ViewLayerID viewLayerID, ViewLayer::ViewLayerSpec viewLayerSpec, bool doConnectors, LayerAttributes & layerAttributes, QString & error)
 
158
bool JumperItem::setUpImage(ModelPart * modelPart, ViewLayer::ViewIdentifier viewIdentifier, const LayerHash & viewLayers, ViewLayer::ViewLayerID viewLayerID, ViewLayer::ViewLayerSpec viewLayerSpec, bool doConnectors, LayerAttributes & layerAttributes, QString & error)
158
159
{
159
160
        bool result = PaletteItem::setUpImage(modelPart, viewIdentifier, viewLayers, viewLayerID, viewLayerSpec, doConnectors, layerAttributes, error);
160
161
 
177
178
        return result;
178
179
}
179
180
 
180
 
void JumperItem::initialResize(ViewIdentifierClass::ViewIdentifier viewIdentifier) {
181
 
        if (viewIdentifier != ViewIdentifierClass::PCBView) return;
 
181
void JumperItem::initialResize(ViewLayer::ViewIdentifier viewIdentifier) {
 
182
        if (viewIdentifier != ViewLayer::PCBView) return;
182
183
 
183
184
        bool ok;
184
185
        double r0x = m_modelPart->localProp("r0x").toDouble(&ok);
335
336
}
336
337
 
337
338
void JumperItem::resize() {
338
 
        if (m_viewIdentifier != ViewIdentifierClass::PCBView) return;
 
339
        if (m_viewIdentifier != ViewLayer::PCBView) return;
339
340
 
340
341
        if (m_connector0 == NULL) return;
341
342
        if (m_connector1 == NULL) return;
426
427
        }
427
428
 
428
429
        if (!xml.isEmpty()) {
429
 
                QString xmlName = ViewLayer::viewLayerXmlNameFromID(viewLayerID);
430
 
                SvgFileSplitter splitter;
431
 
                bool result = splitter.splitString(xml, xmlName);
432
 
                if (!result) {
433
 
                        return ___emptyString___;
434
 
                }
435
 
                result = splitter.normalize(dpi, xmlName, blackOnly);
436
 
                if (!result) {
437
 
                        return ___emptyString___;
438
 
                }
439
 
                return splitter.elementString(xmlName);
 
430
        return PaletteItemBase::normalizeSvg(xml, viewLayerID, blackOnly, dpi);
440
431
        }
441
432
 
442
 
 
443
433
        return PaletteItemBase::retrieveSvg(viewLayerID, svgHash, blackOnly, dpi);
444
434
}
445
435
 
461
451
 
462
452
bool JumperItem::hasCustomSVG() {
463
453
        switch (m_viewIdentifier) {
464
 
                case ViewIdentifierClass::PCBView:
 
454
                case ViewLayer::PCBView:
465
455
                        return true;
466
456
                default:
467
457
                        return ItemBase::hasCustomSVG();
555
545
        return false;
556
546
}
557
547
 
558
 
ViewIdentifierClass::ViewIdentifier JumperItem::useViewIdentifierForPixmap(ViewIdentifierClass::ViewIdentifier vid, bool) 
 
548
ViewLayer::ViewIdentifier JumperItem::useViewIdentifierForPixmap(ViewLayer::ViewIdentifier vid, bool) 
559
549
{
560
 
    if (vid == ViewIdentifierClass::PCBView) {
561
 
        return ViewIdentifierClass::IconView;
 
550
    if (vid == ViewLayer::PCBView) {
 
551
        return ViewLayer::IconView;
562
552
    }
563
553
 
564
 
    return ViewIdentifierClass::UnknownView;
 
554
    return ViewLayer::UnknownView;
565
555
}