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

« back to all changes in this revision

Viewing changes to plugins/defaultTools/defaulttool/DefaultToolTransformWidget.cpp

  • 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:
38
38
#include <QCheckBox>
39
39
#include <QDoubleSpinBox>
40
40
#include <QList>
41
 
#include <QMatrix>
 
41
#include <QTransform>
42
42
 
43
43
DefaultToolTransformWidget::DefaultToolTransformWidget( KoInteractionTool* tool,
44
44
                                    QWidget* parent )
79
79
void DefaultToolTransformWidget::rotationChanged()
80
80
{
81
81
    QList<KoShape*> selectedShapes = m_tool->canvas()->shapeManager()->selection()->selectedShapes( KoFlake::TopLevelSelection );
82
 
    QList<QMatrix> oldTransforms;
 
82
    QList<QTransform> oldTransforms;
83
83
 
84
84
    foreach( KoShape* shape, selectedShapes )
85
85
        oldTransforms << shape->transformation();
86
86
 
87
87
    qreal angle = rotateSpinBox->value();
88
88
    QPointF rotationCenter = m_tool->canvas()->shapeManager()->selection()->absolutePosition( SelectionDecorator::hotPosition() );
89
 
    QMatrix matrix;
 
89
    QTransform matrix;
90
90
    matrix.translate(rotationCenter.x(), rotationCenter.y());
91
91
    matrix.rotate(angle);
92
92
    matrix.translate(-rotationCenter.x(), -rotationCenter.y());
98
98
    }
99
99
 
100
100
    m_tool->canvas()->shapeManager()->selection()->applyAbsoluteTransformation( matrix );
101
 
    QList<QMatrix> newTransforms;
 
101
    QList<QTransform> newTransforms;
102
102
 
103
103
    foreach( KoShape* shape, selectedShapes )
104
104
        newTransforms << shape->transformation();
112
112
{
113
113
    KoSelection* selection = m_tool->canvas()->shapeManager()->selection();
114
114
    QList<KoShape*> selectedShapes = selection->selectedShapes( KoFlake::TopLevelSelection );
115
 
    QList<QMatrix> oldTransforms;
 
115
    QList<QTransform> oldTransforms;
116
116
 
117
117
    foreach( KoShape* shape, selectedShapes )
118
118
        oldTransforms << shape->transformation();
119
119
 
120
120
    qreal shearX = shearXSpinBox->value() / selection->size().height();
121
121
    QPointF basePoint = selection->absolutePosition( SelectionDecorator::hotPosition() );
122
 
    QMatrix matrix;
 
122
    QTransform matrix;
123
123
    matrix.translate(basePoint.x(), basePoint.y());
124
124
    matrix.shear(shearX, 0.0);
125
125
    matrix.translate(-basePoint.x(), -basePoint.y());
131
131
    }
132
132
 
133
133
    selection->applyAbsoluteTransformation( matrix );
134
 
    QList<QMatrix> newTransforms;
 
134
    QList<QTransform> newTransforms;
135
135
 
136
136
    foreach( KoShape* shape, selectedShapes )
137
137
        newTransforms << shape->transformation();
145
145
{
146
146
    KoSelection* selection = m_tool->canvas()->shapeManager()->selection();
147
147
    QList<KoShape*> selectedShapes = selection->selectedShapes( KoFlake::TopLevelSelection );
148
 
    QList<QMatrix> oldTransforms;
 
148
    QList<QTransform> oldTransforms;
149
149
 
150
150
    foreach( KoShape* shape, selectedShapes )
151
151
        oldTransforms << shape->transformation();
152
152
 
153
153
    qreal shearY = shearYSpinBox->value() / selection->size().width();
154
154
    QPointF basePoint = selection->absolutePosition( SelectionDecorator::hotPosition() );
155
 
    QMatrix matrix;
 
155
    QTransform matrix;
156
156
    matrix.translate(basePoint.x(), basePoint.y());
157
157
    matrix.shear(0.0, shearY);
158
158
    matrix.translate(-basePoint.x(), -basePoint.y());
164
164
    }
165
165
 
166
166
    selection->applyAbsoluteTransformation( matrix );
167
 
    QList<QMatrix> newTransforms;
 
167
    QList<QTransform> newTransforms;
168
168
 
169
169
    foreach( KoShape* shape, selectedShapes )
170
170
        newTransforms << shape->transformation();
177
177
void DefaultToolTransformWidget::scaleXChanged()
178
178
{
179
179
    QList<KoShape*> selectedShapes = m_tool->canvas()->shapeManager()->selection()->selectedShapes( KoFlake::TopLevelSelection );
180
 
    QList<QMatrix> oldTransforms;
 
180
    QList<QTransform> oldTransforms;
181
181
 
182
182
    foreach( KoShape* shape, selectedShapes )
183
183
        oldTransforms << shape->transformation();
184
184
 
185
185
    qreal scale = scaleXSpinBox->value() * 0.01; // Input is in per cent
186
186
    QPointF basePoint = m_tool->canvas()->shapeManager()->selection()->absolutePosition( SelectionDecorator::hotPosition() );
187
 
    QMatrix matrix;
 
187
    QTransform matrix;
188
188
    matrix.translate(basePoint.x(), basePoint.y());
189
189
 
190
190
    if(scaleAspectCheckBox->isChecked())
201
201
    }
202
202
 
203
203
    m_tool->canvas()->shapeManager()->selection()->applyAbsoluteTransformation( matrix );
204
 
    QList<QMatrix> newTransforms;
 
204
    QList<QTransform> newTransforms;
205
205
 
206
206
    foreach( KoShape* shape, selectedShapes )
207
207
        newTransforms << shape->transformation();
214
214
void DefaultToolTransformWidget::scaleYChanged()
215
215
{
216
216
    QList<KoShape*> selectedShapes = m_tool->canvas()->shapeManager()->selection()->selectedShapes( KoFlake::TopLevelSelection );
217
 
    QList<QMatrix> oldTransforms;
 
217
    QList<QTransform> oldTransforms;
218
218
 
219
219
    foreach( KoShape* shape, selectedShapes )
220
220
        oldTransforms << shape->transformation();
221
221
 
222
222
    qreal scale = scaleYSpinBox->value() * 0.01; // Input is in per cent
223
223
    QPointF basePoint = m_tool->canvas()->shapeManager()->selection()->absolutePosition( SelectionDecorator::hotPosition() );
224
 
    QMatrix matrix;
 
224
    QTransform matrix;
225
225
    matrix.translate(basePoint.x(), basePoint.y());
226
226
    matrix.scale(1.0, scale);
227
227
    matrix.translate(-basePoint.x(), -basePoint.y());
233
233
    }
234
234
 
235
235
    m_tool->canvas()->shapeManager()->selection()->applyAbsoluteTransformation( matrix );
236
 
    QList<QMatrix> newTransforms;
 
236
    QList<QTransform> newTransforms;
237
237
 
238
238
    foreach( KoShape* shape, selectedShapes )
239
239
        newTransforms << shape->transformation();
246
246
void DefaultToolTransformWidget::resetTransformations()
247
247
{
248
248
    QList<KoShape*> selectedShapes = m_tool->canvas()->shapeManager()->selection()->selectedShapes( KoFlake::TopLevelSelection );
249
 
    QList<QMatrix> oldTransforms;
 
249
    QList<QTransform> oldTransforms;
250
250
 
251
251
    foreach( KoShape* shape, selectedShapes )
252
252
        oldTransforms << shape->transformation();
253
253
 
254
 
    QMatrix matrix;
 
254
    QTransform matrix;
255
255
 
256
256
    foreach( KoShape * shape, selectedShapes ) {
257
257
        shape->update();
260
260
    }
261
261
 
262
262
    m_tool->canvas()->shapeManager()->selection()->applyAbsoluteTransformation( matrix );
263
 
    QList<QMatrix> newTransforms;
 
263
    QList<QTransform> newTransforms;
264
264
 
265
265
    foreach( KoShape* shape, selectedShapes )
266
266
        newTransforms << shape->transformation();