~ubuntu-branches/ubuntu/oneiric/koffice/oneiric-updates

« back to all changes in this revision

Viewing changes to krita/plugins/paintops/spray/kis_spray_shape_dynamics.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2010-10-27 17:52:57 UTC
  • mfrom: (0.12.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20101027175257-s04zqqk5bs8ckm9o
Tags: 1:2.2.83-0ubuntu1
* Merge with Debian git remaining changes:
 - Add build-deps on librcps-dev, opengtl-dev, libqtgtl-dev, freetds-dev,
   create-resources, libspnav-dev
 - Remove needless build-dep on libwv2-dev
 - koffice-libs recommends create-resources
 - krita recommends pstoedit
 - Keep our patches
* New upstream release 2.3 beta 3
  - Remove debian/patches fixed by upstream
  - Update install files

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 *  Copyright (c) 2010 Lukáš Tvrdý <lukast.dev@gmail.com>
 
3
 *
 
4
 *  This program is free software; you can redistribute it and/or modify
 
5
 *  it under the terms of the GNU General Public License as published by
 
6
 *  the Free Software Foundation; either version 2 of the License, or
 
7
 *  (at your option) any later version.
 
8
 *
 
9
 *  This program is distributed in the hope that it will be useful,
 
10
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
 *  GNU General Public License for more details.
 
13
 *
 
14
 *  You should have received a copy of the GNU General Public License
 
15
 *  along with this program; if not, write to the Free Software
 
16
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 
17
 */
 
18
 
 
19
#ifndef KIS_SPRAY_SHAPE_DYNAMICS_OPTION_H
 
20
#define KIS_SPRAY_SHAPE_DYNAMICS_OPTION_H
 
21
 
 
22
#include <kis_paintop_option.h>
 
23
 
 
24
const QString SHAPE_DYNAMICS_VERSION = "ShapeDynamicsVersion";
 
25
 
 
26
// Old Krita 2.2.x strings for backward compatibility
 
27
const QString SPRAYSHAPE_RANDOM_SIZE = "SprayShape/randomSize";
 
28
const QString SPRAYSHAPE_FIXED_ROTATION = "SprayShape/fixedRotation";
 
29
const QString SPRAYSHAPE_FIXED_ANGEL = "SprayShape/fixedAngle";
 
30
const QString SPRAYSHAPE_RANDOM_ROTATION = "SprayShape/randomRotation";
 
31
const QString SPRAYSHAPE_RANDOM_ROTATION_WEIGHT = "SprayShape/randomRotationWeight";
 
32
const QString SPRAYSHAPE_FOLLOW_CURSOR = "SprayShape/followCursor";
 
33
const QString SPRAYSHAPE_FOLLOW_CURSOR_WEIGHT = "SprayShape/followCursorWeigth";
 
34
const QString SPRAYSHAPE_DRAWING_ANGLE = "SprayShape/followDrawingAngle";
 
35
const QString SPRAYSHAPE_DRAWING_ANGLE_WEIGHT = "SprayShape/followDrawingAngleWeigth";
 
36
 
 
37
// My intention is to have the option dialog more general so that it can be share 
 
38
// hence the suffix ShapeDynamics
 
39
const QString SHAPE_DYNAMICS_ENABLED = "ShapeDynamics/enabled";
 
40
const QString SHAPE_DYNAMICS_RANDOM_SIZE = "ShapeDynamics/randomSize";
 
41
const QString SHAPE_DYNAMICS_FIXED_ROTATION = "ShapeDynamics/fixedRotation";
 
42
const QString SHAPE_DYNAMICS_FIXED_ANGEL = "ShapeDynamics/fixedAngle";
 
43
const QString SHAPE_DYNAMICS_RANDOM_ROTATION = "ShapeDynamics/randomRotation";
 
44
const QString SHAPE_DYNAMICS_RANDOM_ROTATION_WEIGHT = "ShapeDynamics/randomRotationWeight";
 
45
const QString SHAPE_DYNAMICS_FOLLOW_CURSOR = "ShapeDynamics/followCursor";
 
46
const QString SHAPE_DYNAMICS_FOLLOW_CURSOR_WEIGHT = "ShapeDynamics/followCursorWeigth";
 
47
const QString SHAPE_DYNAMICS_DRAWING_ANGLE = "ShapeDynamics/followDrawingAngle";
 
48
const QString SHAPE_DYNAMICS_DRAWING_ANGLE_WEIGHT = "ShapeDynamics/followDrawingAngleWeigth";
 
49
 
 
50
class KisShapeDynamicsOptionsWidget;
 
51
 
 
52
class KisSprayShapeDynamicsOption : public KisPaintOpOption
 
53
{
 
54
    Q_OBJECT
 
55
public:
 
56
    KisSprayShapeDynamicsOption();
 
57
    ~KisSprayShapeDynamicsOption();
 
58
    
 
59
    void writeOptionSetting(KisPropertiesConfiguration* setting) const;
 
60
    void readOptionSetting(const KisPropertiesConfiguration* setting);
 
61
 
 
62
private:
 
63
    void setupBrushPreviewSignals();
 
64
    
 
65
private:
 
66
    KisShapeDynamicsOptionsWidget * m_options;
 
67
};
 
68
 
 
69
 
 
70
class KisShapeDynamicsProperties{
 
71
public:
 
72
    bool enabled;
 
73
    // particle size dynamics
 
74
    bool randomSize;
 
75
    // rotation dynamics
 
76
    bool fixedRotation;
 
77
    bool randomRotation;
 
78
    bool followCursor;
 
79
    bool followDrawingAngle;
 
80
    quint16 fixedAngle;
 
81
    qreal randomRotationWeight;
 
82
    qreal followCursorWeigth;
 
83
    qreal followDrawingAngleWeight;
 
84
 
 
85
public:
 
86
    
 
87
    void loadSettings(const KisPropertiesConfiguration* settings){
 
88
        // Krita 2.2
 
89
        if (settings->getString(SHAPE_DYNAMICS_VERSION, "2.2") == "2.2")
 
90
        {
 
91
            randomSize = settings->getBool(SPRAYSHAPE_RANDOM_SIZE);
 
92
            // rotation
 
93
            fixedRotation = settings->getBool(SPRAYSHAPE_FIXED_ROTATION);
 
94
            randomRotation = settings->getBool(SPRAYSHAPE_RANDOM_ROTATION);
 
95
            followCursor = settings->getBool(SPRAYSHAPE_FOLLOW_CURSOR);
 
96
            followDrawingAngle = settings->getBool(SPRAYSHAPE_DRAWING_ANGLE);
 
97
            fixedAngle = settings->getInt(SPRAYSHAPE_FIXED_ANGEL);
 
98
            randomRotationWeight = settings->getDouble(SPRAYSHAPE_RANDOM_ROTATION_WEIGHT);
 
99
            followCursorWeigth = settings->getDouble(SPRAYSHAPE_FOLLOW_CURSOR_WEIGHT);
 
100
            followDrawingAngleWeight = settings->getDouble(SPRAYSHAPE_DRAWING_ANGLE_WEIGHT);
 
101
            enabled = true;
 
102
        }
 
103
        // Krita latest
 
104
        else
 
105
        {
 
106
            enabled = settings->getBool(SHAPE_DYNAMICS_ENABLED);
 
107
            // particle type size
 
108
            randomSize = settings->getBool(SHAPE_DYNAMICS_RANDOM_SIZE);
 
109
            // rotation dynamics
 
110
            fixedRotation = settings->getBool(SHAPE_DYNAMICS_FIXED_ROTATION);
 
111
            randomRotation = settings->getBool(SHAPE_DYNAMICS_RANDOM_ROTATION);
 
112
            followCursor = settings->getBool(SHAPE_DYNAMICS_FOLLOW_CURSOR);
 
113
            followDrawingAngle = settings->getBool(SHAPE_DYNAMICS_DRAWING_ANGLE);
 
114
            fixedAngle = settings->getInt(SHAPE_DYNAMICS_FIXED_ANGEL);
 
115
            randomRotationWeight = settings->getDouble(SHAPE_DYNAMICS_RANDOM_ROTATION_WEIGHT);
 
116
            followCursorWeigth = settings->getDouble(SHAPE_DYNAMICS_FOLLOW_CURSOR_WEIGHT);
 
117
            followDrawingAngleWeight = settings->getDouble(SHAPE_DYNAMICS_DRAWING_ANGLE_WEIGHT);
 
118
        }        
 
119
    }
 
120
};
 
121
 
 
122
#endif // KIS_SPRAY_SHAPE_DYNAMICS_OPTION_H
 
123