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

« back to all changes in this revision

Viewing changes to src/svg/svgfilesplitter.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:
18
18
 
19
19
********************************************************************
20
20
 
21
 
$Revision: 5143 $:
 
21
$Revision: 5308 $:
22
22
$Author: cohen@irascible.com $:
23
 
$Date: 2011-07-01 02:37:01 +0200 (Fri, 01 Jul 2011) $
 
23
$Date: 2011-07-30 21:09:56 +0200 (Sat, 30 Jul 2011) $
24
24
 
25
25
********************************************************************/
26
26
 
40
40
struct PathUserData {
41
41
        QString string;
42
42
    QMatrix transform;
43
 
        qreal sNewWidth;
44
 
        qreal sNewHeight;
45
 
        qreal vbWidth; 
46
 
        qreal vbHeight;
47
 
        qreal x;
48
 
        qreal y;
 
43
        double sNewWidth;
 
44
        double sNewHeight;
 
45
        double vbWidth; 
 
46
        double vbHeight;
 
47
        double x;
 
48
        double y;
49
49
        bool pathStarting;
50
50
        QPainterPath * painterPath;
51
51
};
59
59
        bool splitString(QString & contents, const QString & elementID);
60
60
        const QByteArray & byteArray();
61
61
        const QDomDocument & domDocument();
62
 
        bool normalize(qreal dpi, const QString & elementID, bool blackOnly);
63
 
        QString shift(qreal x, qreal y, const QString & elementID, bool shiftTransforms);
 
62
        bool normalize(double dpi, const QString & elementID, bool blackOnly);
 
63
        QString shift(double x, double y, const QString & elementID, bool shiftTransforms);
64
64
        QString elementString(const QString & elementID);
65
65
    virtual bool parsePath(const QString & data, const char * slot, PathUserData &, QObject * slotTarget, bool convertHV);
66
66
        QVector<QVariant> simpleParsePath(const QString & data);
67
 
        QPainterPath painterPath(qreal dpi, const QString & elementID);                 // note: only partially implemented
68
 
        void shiftChild(QDomElement & element, qreal x, qreal y, bool shiftTransforms);
 
67
        QPainterPath painterPath(double dpi, const QString & elementID);                        // note: only partially implemented
 
68
        void shiftChild(QDomElement & element, double x, double y, bool shiftTransforms);
69
69
        bool load(const QString * filename);
70
70
        bool load(QFile *);
71
71
        bool load(const QString string);
72
72
        QString toString();
73
73
        void gWrap(const QHash<QString, QString> & attributes);
 
74
        void gReplace(const QString & id);
74
75
 
75
76
public:
76
77
        static bool getSvgSizeAttributes(const QString & svg, QString & width, QString & height, QString & viewBox);
77
 
        static bool changeStrokeWidth(const QString & svg, qreal delta, bool absolute, QByteArray &);
 
78
        static bool changeStrokeWidth(const QString & svg, double delta, bool absolute, QByteArray &);
78
79
        static bool changeColors(const QString & svg, QString & toColor, QStringList & exceptions, QByteArray &);
79
80
        static void changeColors(QDomElement & element, QString & toColor, QStringList & exceptions);
80
81
        static void fixStyleAttributeRecurse(QDomElement & element);
83
84
 
84
85
protected:
85
86
        void normalizeChild(QDomElement & childElement, 
86
 
                                                qreal sNewWidth, qreal sNewHeight,
87
 
                                                qreal vbWidth, qreal vbHeight, bool blackOnly);
88
 
        bool normalizeAttribute(QDomElement & element, const char * attributeName, qreal num, qreal denom);
 
87
                                                double sNewWidth, double sNewHeight,
 
88
                                                double vbWidth, double vbHeight, bool blackOnly);
 
89
        bool normalizeAttribute(QDomElement & element, const char * attributeName, double num, double denom);
89
90
        void painterPathChild(QDomElement & element, QPainterPath & ppath);                     // note: only partially implemented
90
91
        void normalizeTranslation(QDomElement & element, 
91
 
                                                        qreal sNewWidth, qreal sNewHeight,
92
 
                                                        qreal vbWidth, qreal vbHeight);
93
 
        bool shiftTranslation(QDomElement & element, qreal x, qreal y);
 
92
                                                        double sNewWidth, double sNewHeight,
 
93
                                                        double vbWidth, double vbHeight);
 
94
        bool shiftTranslation(QDomElement & element, double x, double y);
94
95
        void standardArgs(bool relative, bool starting, QList<double> & args, PathUserData * pathUserData);
95
96
 
96
97
protected:
97
 
        static void changeStrokeWidth(QDomElement & element, qreal delta, bool absolute);
 
98
        static void changeStrokeWidth(QDomElement & element, double delta, bool absolute);
98
99
        static void fixStyleAttribute(QDomElement & element);
99
 
        static bool shiftAttribute(QDomElement & element, const char * attributeName, qreal d);
100
 
        static void setStrokeOrFill(QDomElement & element, bool doIt, const QString & color);
 
100
        static bool shiftAttribute(QDomElement & element, const char * attributeName, double d);
 
101
        static void setStrokeOrFill(QDomElement & element, bool doIt, const QString & color, bool force);
101
102
 
102
103
protected slots:
103
104
        void normalizeCommandSlot(QChar command, bool relative, QList<double> & args, void * userData);