Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 456b48d2 authored by Thomas Zander's avatar Thomas Zander

Less compiler warnings, some coding-style cleanup.

SVN_SILENT

svn path=/trunk/koffice/; revision=880167
parent 1776e2c8
......@@ -55,7 +55,7 @@ ShapeMoveStrategy::ShapeMoveStrategy( KoTool *tool, KoCanvasBase *canvas, const
tool->setStatusText( i18n("Press ALT to hold x- or y-position.") );
}
void ShapeMoveStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardModifiers modifiers)
void ShapeMoveStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardModifiers modifiers)
{
if(m_selectedShapes.isEmpty())
return;
......@@ -101,6 +101,7 @@ void ShapeMoveStrategy::handleCustomEvent( KoPointerEvent * event )
void ShapeMoveStrategy::moveBy( const QPointF &diff )
{
Q_UNUSED(diff);
Q_ASSERT(m_newPositions.count());
int i=0;
......@@ -119,14 +120,16 @@ void ShapeMoveStrategy::moveBy( const QPointF &diff )
m_canvas->shapeManager()->selection()->setPosition(m_initialSelectionPosition + m_diff);
}
QUndoCommand* ShapeMoveStrategy::createCommand() {
QUndoCommand* ShapeMoveStrategy::createCommand()
{
m_canvas->snapGuide()->reset();
if(m_diff.x() == 0 && m_diff.y() == 0)
return 0;
return new KoShapeMoveCommand(m_selectedShapes, m_previousPositions, m_newPositions);
}
void ShapeMoveStrategy::paint( QPainter &painter, const KoViewConverter &converter) {
void ShapeMoveStrategy::paint( QPainter &painter, const KoViewConverter &converter)
{
SelectionDecorator decorator (KoFlake::NoHandle, false, false);
decorator.setSelection(m_canvas->shapeManager()->selection());
decorator.setHandleRadius( m_canvas->resourceProvider()->handleRadius() );
......
......@@ -39,7 +39,7 @@ ShapeResizeStrategy::ShapeResizeStrategy( KoTool *tool, KoCanvasBase *canvas,
Q_ASSERT( canvas->shapeManager()->selection()->count() > 0);
QList<KoShape*> selectedShapes = canvas->shapeManager()->selection()->selectedShapes(KoFlake::StrippedSelection);
foreach(KoShape *shape, selectedShapes) {
if( ! shape->isEditable() )
if ( ! shape->isEditable() )
continue;
m_selectedShapes << shape;
m_startPositions << shape->position();
......@@ -50,12 +50,12 @@ ShapeResizeStrategy::ShapeResizeStrategy( KoTool *tool, KoCanvasBase *canvas,
m_start = clicked;
KoShape *shp = 0;
if(canvas->shapeManager()->selection()->count()>1)
if (canvas->shapeManager()->selection()->count()>1)
shp = canvas->shapeManager()->selection();
if(canvas->shapeManager()->selection()->count()==1)
if (canvas->shapeManager()->selection()->count()==1)
shp = canvas->shapeManager()->selection()->firstSelectedShape();
if( shp )
if ( shp )
{
m_windMatrix = shp->absoluteTransformation(0);
m_unwindMatrix = m_windMatrix.inverted();
......@@ -109,17 +109,17 @@ void ShapeResizeStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardModi
QPointF distance = m_unwindMatrix.map(newPos) - m_unwindMatrix.map( m_start );
qreal zoomX=1, zoomY=1;
if(m_left)
if (m_left)
zoomX = (startWidth - distance.x()) / startWidth;
else if(m_right)
else if (m_right)
zoomX = (startWidth + distance.x()) / startWidth;
if(m_top)
if (m_top)
zoomY = (startHeight - distance.y()) / startHeight;
else if(m_bottom)
else if (m_bottom)
zoomY = (startHeight + distance.y()) / startHeight;
if(keepAspect) {
if (keepAspect) {
const bool cornerUsed = ((m_bottom?1:0) + (m_top?1:0) + (m_left?1:0) + (m_right?1:0)) == 2;
if(cornerUsed && startWidth < startHeight || m_left || m_right)
if ((cornerUsed && startWidth < startHeight) || m_left || m_right)
zoomY = zoomX;
else
zoomX = zoomY;
......@@ -128,7 +128,7 @@ void ShapeResizeStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardModi
bool scaleFromCenter = modifiers & Qt::ControlModifier;
QPointF move;
if(scaleFromCenter)
if (scaleFromCenter)
move = QPointF(startWidth / 2.0, startHeight / 2.0);
else
move = QPointF(m_left?startWidth:0, m_top?startHeight:0);
......@@ -218,11 +218,12 @@ void ShapeResizeStrategy::resizeBy( const QPointF &center, qreal zoomX, qreal zo
m_scaleMatrix = matrix;
}
QUndoCommand* ShapeResizeStrategy::createCommand() {
QUndoCommand* ShapeResizeStrategy::createCommand()
{
QList<QSizeF> newSizes;
QList<QMatrix> transformations;
const int shapeCount = m_selectedShapes.count();
for( int i = 0; i < shapeCount; ++i )
for ( int i = 0; i < shapeCount; ++i )
{
newSizes << m_selectedShapes[i]->size();
transformations << m_selectedShapes[i]->transformation();
......@@ -233,7 +234,8 @@ QUndoCommand* ShapeResizeStrategy::createCommand() {
return cmd;
}
void ShapeResizeStrategy::paint( QPainter &painter, const KoViewConverter &converter) {
void ShapeResizeStrategy::paint( QPainter &painter, const KoViewConverter &converter)
{
SelectionDecorator decorator (KoFlake::NoHandle, false, false);
decorator.setSelection(m_canvas->shapeManager()->selection());
decorator.setHandleRadius( m_canvas->resourceProvider()->handleRadius() );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment