Subversion Repositories Scribus

Rev

Rev 17539 | Rev 18330 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
12066 fschmid 1
/*
2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
6
*/
7
/***************************************************************************
8
*   Copyright (C) 2007 by Franz Schmid                                     *
9
*   franz.schmid@altmuehlnet.de                                            *
10
*                                                                          *
11
*   This program is free software; you can redistribute it and/or modify   *
12
*   it under the terms of the GNU General Public License as published by   *
13
*   the Free Software Foundation; either version 2 of the License, or      *
14
*   (at your option) any later version.                                    *
15
*                                                                          *
16
*   This program is distributed in the hope that it will be useful,        *
17
*   but WITHOUT ANY WARRANTY; without even the implied warranty of         *
18
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
19
*   GNU General Public License for more details.                           *
20
*                                                                          *
21
*   You should have received a copy of the GNU General Public License      *
22
*   along with this program; if not, write to the                          *
23
*   Free Software Foundation, Inc.,                                        *
18122 mrdocs 24
*   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.              *
12066 fschmid 25
****************************************************************************/
26
 
27
#ifndef PATHALONGPATH_H
28
#define PATHALONGPATH_H
29
 
30
#include "pluginapi.h"
31
#include "scplugin.h"
32
#include "selection.h"
33
 
17539 jghali 34
#if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES)
14170 jghali 35
#define _USE_MATH_DEFINES
36
#endif
37
 
15347 fschmid 38
#include "third_party/lib2geom/d2.h"
39
#include "third_party/lib2geom/piecewise.h"
40
#include "third_party/lib2geom/sbasis.h"
41
#include "third_party/lib2geom/sbasis-geometric.h"
42
#include "third_party/lib2geom/bezier-to-sbasis.h"
43
#include "third_party/lib2geom/sbasis-to-bezier.h"
44
#include "third_party/lib2geom/utils.h"
45
#include "third_party/lib2geom/path.h"
46
#include "third_party/lib2geom/sbasis-2d.h"
14937 fschmid 47
#include "third_party/lib2geom/scribushelper.h"
12066 fschmid 48
#include <vector>
15347 fschmid 49
using namespace Geom;
12066 fschmid 50
 
51
/** \brief This is a simple "PathAlongPath" plugin for Scribus 1.3 and later.
52
\author Franz Schmid
53
\date November 2007
54
*/
55
class PLUGIN_API PathAlongPathPlugin : public ScActionPlugin
56
{
57
        Q_OBJECT
58
 
59
        public:
60
                // Standard plugin implementation
61
                PathAlongPathPlugin();
62
                virtual ~PathAlongPathPlugin();
63
                virtual bool run(ScribusDoc* doc, QString target = QString::null);
64
                virtual const QString fullTrName() const;
65
                virtual const AboutData* getAboutData() const;
66
                virtual void deleteAboutData(const AboutData* about) const;
67
                virtual void languageChange();
68
                virtual void addToMainWindowMenu(ScribusMainWindow *) {};
12577 fschmid 69
                bool handleSelection(ScribusDoc* doc, int SelectedType);
70
        private:
12597 fschmid 71
                void setUpEffect(Geom::Piecewise<Geom::D2<Geom::SBasis> > &pwd2_in, Geom::Piecewise<Geom::D2<Geom::SBasis> > &pattern, int effect, double offset, double offsetY, double gap, int rotate);
12577 fschmid 72
                FPointArray doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pattern);
12066 fschmid 73
                PageItem *patternItem;
74
                PageItem *pathItem;
75
                FPointArray originalPath;
12668 fschmid 76
                FPointArray effectPath;
12659 fschmid 77
                double originalRot;
12066 fschmid 78
                double originalXPos;
79
                double originalYPos;
80
                ScribusDoc* currDoc;
12191 fschmid 81
                bool firstUpdate;
15344 fschmid 82
                Geom::Piecewise<Geom::D2<Geom::SBasis> > uskeleton;
83
                Geom::Piecewise<Geom::D2<Geom::SBasis> > n;
12577 fschmid 84
                double m_scaling;
85
                int nbCopies;
86
                double pattWidth;
87
                double m_offsetX;
88
                double m_offsetY;
89
                double m_gapval;
12597 fschmid 90
                int m_rotate;
15344 fschmid 91
                Geom::Interval pattBnds;
92
                Geom::Interval pattBndsY;
12577 fschmid 93
                int selOffs;
94
                int selCount;
95
                QList<FPointArray> originalPathG;
12659 fschmid 96
                QList<double> originalRotG;
12577 fschmid 97
                QList<double> originalXPosG;
98
                QList<double> originalYPosG;
16161 fschmid 99
                QList<double> originalXPosGi;
100
                QList<double> originalYPosGi;
101
                QList<double> originalWidthG;
102
                QList<double> originalHeightG;
103
                QList<double> originalWidth;
104
                QList<double> originalHeight;
12577 fschmid 105
                QList<PageItem *> patternItemG;
106
        private slots:
12597 fschmid 107
                void updateEffectG(int effectType, double offset, double offsetY, double gap, int rotate);
108
                void updateEffect(int effectType, double offset, double offsetY, double gap, int rotate);
12066 fschmid 109
 
110
                // Special features (none)
111
};
112
 
113
extern "C" PLUGIN_API int pathalongpath_getPluginAPIVersion();
114
extern "C" PLUGIN_API ScPlugin* pathalongpath_getPlugin();
115
extern "C" PLUGIN_API void pathalongpath_freePlugin(ScPlugin* plugin);
116
 
117
#endif