Scribus
Open source desktop publishing at your fingertips
pathalongpath.h
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., *
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
25 ****************************************************************************/
26 
27 #ifndef PATHALONGPATH_H
28 #define PATHALONGPATH_H
29 
30 #include "pluginapi.h"
31 #include "scplugin.h"
32 #include "selection.h"
33 
34 #if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES)
35 #define _USE_MATH_DEFINES
36 #endif
37 
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"
47 #include "third_party/lib2geom/scribushelper.h"
48 #include <vector>
49 using namespace Geom;
50 
55 class PLUGIN_API PathAlongPathPlugin : public ScActionPlugin
56 {
57  Q_OBJECT
58 
59  public:
60  // Standard plugin implementation
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();
69  bool handleSelection(ScribusDoc* doc, int SelectedType);
70  private:
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);
72  FPointArray doEffect_pwd2 (Geom::Piecewise<Geom::D2<Geom::SBasis> > & pattern);
73  PageItem *patternItem;
74  PageItem *pathItem;
75  FPointArray originalPath;
76  FPointArray effectPath;
77  double originalRot;
78  double originalXPos;
79  double originalYPos;
80  ScribusDoc* m_doc;
81  bool firstUpdate;
84  double m_scaling;
85  int nbCopies;
86  double pattWidth;
87  double m_offsetX;
88  double m_offsetY;
89  double m_gapval;
90  int m_rotate;
91  Geom::Interval pattBnds;
92  Geom::Interval pattBndsY;
93  int selOffs;
94  int selCount;
95  QList<FPointArray> originalPathG;
96  QList<double> originalRotG;
97  QList<double> originalXPosG;
98  QList<double> originalYPosG;
99  QList<double> originalXPosGi;
100  QList<double> originalYPosGi;
101  QList<double> originalWidthG;
102  QList<double> originalHeightG;
103  QList<double> originalWidth;
104  QList<double> originalHeight;
105  QList<PageItem *> patternItemG;
106  private slots:
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);
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
Definition: angle.h:38
A plug-in that performs a single action.
Definition: scplugin.h:248
Abstract super class for all Scribus plug-ins.
Definition: scplugin.h:90
This Class is the base class for your application. It sets up the main window and providing a menubar...
Definition: scribus.h:123
Definition: piecewise.h:45
the Document Class
Definition: scribusdoc.h:90
virtual void addToMainWindowMenu(ScribusMainWindow *)
Allow plugins to add to a main menu.
Definition: pathalongpath.h:68
ScPlugin provides an interface to ask plugins for information about themselves.
Definition: scplugin.h:103
Definition: pageitem.h:92
Definition: fpointarray.h:42
This is a simple "PathAlongPath" plugin for Scribus 1.3 and later.
Definition: pathalongpath.h:55
Definition: interval.h:56