Subversion Repositories Scribus

Rev

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

Rev Author Line No. Line
16311 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
*                                                                         *
9
*   This program is free software; you can redistribute it and/or modify  *
10
*   it under the terms of the GNU General Public License as published by  *
11
*   the Free Software Foundation; either version 2 of the License, or     *
12
*   (at your option) any later version.                                   *
13
*                                                                         *
14
***************************************************************************/
15
/***************************************************************************
16
                 canvasmode_editspiral.h  -  description
17
                             -------------------
18
    begin                : Wed Jan 27 2011
19
    copyright            : (C) 2011 by Franz Schmid
20
    email                : Franz.Schmid@altmuehlnet.de
21
 ***************************************************************************/
22
 
23
#ifndef CANVAS_MODE_EDITSPIRAL_H
24
#define CANVAS_MODE_EDITSPIRAL_H
25
 
26
#include <QObject>
27
#include <QTime>
28
 
29
#include "canvasmode.h"
30
#include "fpointarray.h"
31
#include "ui/spiralvectordialog.h"
32
 
33
class PageItem;
34
class ScribusMainWindow;
35
class ScribusView;
36
 
37
 
38
// This class encapsulate the old code for mouse interaction from scribusview.cpp
39
 
40
class CanvasMode_EditSpiral :  public CanvasMode
41
{      
42
        Q_OBJECT
43
public:
44
        CanvasMode_EditSpiral(ScribusView* view);
45
 
46
        virtual void enterEvent(QEvent *);
47
        virtual void leaveEvent(QEvent *);
48
 
49
        virtual void activate(bool);
50
        virtual void deactivate(bool);
51
        virtual void mouseDoubleClickEvent(QMouseEvent *m);
52
        virtual void mouseReleaseEvent(QMouseEvent *m);
53
        virtual void mouseMoveEvent(QMouseEvent *m);
54
        virtual void mousePressEvent(QMouseEvent *m);
55
        virtual void drawControls(QPainter* p);
56
        void drawControlsSpiral(QPainter* pp, PageItem* currItem);
57
 
58
private:
59
 
60
        typedef enum
61
        {
62
                noPointDefined,
63
                useControlStart,
64
                useControlEnd,
65
        } eSpiralPoint;
66
 
67
        inline bool GetItem(PageItem** pi);
16312 fschmid 68
        QPointF getSegment(double angle);
16314 fschmid 69
        double computeRealAngle(double angle, bool fromDia);
16311 fschmid 70
 
71
        double Mxp, Myp;
72
        ScribusMainWindow* m_ScMW;
73
        QPointF startPoint;
74
        QPointF endPoint;
75
        double startAngle;
76
        double endAngle;
77
        eSpiralPoint m_arcPoint;
78
        SpiralVectorDialog* VectorDialog;
79
 
16546 jghali 80
        int    m_blockUpdateFromItem;
81
        void   blockUpdateFromItem(bool block) { if (block) ++m_blockUpdateFromItem; else --m_blockUpdateFromItem; }
82
        bool   updateFromItemBlocked() { return (m_blockUpdateFromItem > 0); }
83
 
16311 fschmid 84
public slots:
85
        void updateFromItem();
86
 
87
private slots:
88
        void endEditing(bool active);
89
        void endEditing();
16313 fschmid 90
        void applyValues(double start, double end, double factor);
16311 fschmid 91
};
92
 
93
 
94
#endif