Commit 0d67b9ec authored by Inge Wallin's avatar Inge Wallin

Rename repaint() --> update() in KoShape and KoShapeManager.

The rest of the changes are just results of this one.

The reason for the name change is to follow the Qt naming standard.


svn path=/trunk/koffice/; revision=725661
parent a5a2ef44
......@@ -75,7 +75,7 @@ void KritaShape::slotLoadingFinished()
if ( m_d && m_d->doc && m_d->doc->image() ) {
// XXX: Resize image to correct aspect ratio
m_waiter.wakeAll();
repaint();
update();
}
m_mutex.unlock();
......@@ -103,7 +103,7 @@ void KritaShape::paint( QPainter& painter, const KoViewConverter& converter )
void KritaShape::setDisplayProfile( const QString & profileName ) {
m_d->displayProfile = KoColorSpaceRegistry::instance()->profileByName( profileName );
repaint();
update();
}
void KritaShape::saveOdf( KoShapeSavingContext & context ) const {
......
......@@ -171,7 +171,7 @@ void Viewport::handleDropEvent(QDropEvent *event) {
// repaint selection before selecting newly create shape
foreach( KoShape * shape, selection->selectedShapes() )
shape->repaint();
shape->update();
selection->deselectAll();
selection->select(m_draggedShape);
......@@ -195,10 +195,10 @@ QPointF Viewport::correctPosition(const QPoint &point) const {
void Viewport::handleDragMoveEvent (QDragMoveEvent *event) {
if(m_draggedShape == 0)
return;
m_draggedShape->repaint();
m_draggedShape->update();
repaint(m_draggedShape);
m_draggedShape->setAbsolutePosition( correctPosition(event->pos()) );
m_draggedShape->repaint();
m_draggedShape->update();
repaint(m_draggedShape);
}
......
......@@ -47,12 +47,12 @@ void KoParameterShape::moveHandle( int handleId, const QPointF & point, Qt::Keyb
return;
}
repaint();
update();
// function to do special stuff
moveHandleAction( handleId, documentToShape( point ), modifiers );
updatePath( size() );
repaint();
update();
}
......
......@@ -341,22 +341,22 @@ int KoShape::zIndex() const {
return d->zIndex;
}
void KoShape::repaint() const {
void KoShape::update() const {
if ( !d->shapeManagers.empty() )
{
QRectF rect( boundingRect() );
foreach( KoShapeManager * manager, d->shapeManagers )
manager->repaint( rect, this, true );
manager->update( rect, this, true );
}
}
void KoShape::repaint(const QRectF &shape) const {
void KoShape::update(const QRectF &shape) const {
if ( !d->shapeManagers.empty() && isVisible() )
{
QRectF rect(absoluteTransformation(0).mapRect(shape));
foreach( KoShapeManager * manager, d->shapeManagers )
{
manager->repaint(rect);
manager->update(rect);
}
}
}
......
......@@ -391,7 +391,7 @@ public:
* <p>This method will return immediately and only request a repaint. Successive calls
* will be merged into an appropriate repaint action.
*/
virtual void repaint() const;
virtual void update() const;
/**
* Request a repaint to be queued.
......@@ -402,7 +402,7 @@ public:
* will be merged into an appropriate repaint action.
* @param shape the rectangle (in pt) to queue for repaint.
*/
void repaint(const QRectF &shape) const;
void update(const QRectF &shape) const;
/**
* This is a method used to sort a list using the STL sorting methods.
......
......@@ -44,9 +44,9 @@ public:
if(relation->m_inside == clipping)
return;
relation->m_inside = clipping;
relation->child()->repaint();
relation->child()->update();
relation->child()->notifyChanged();
relation->child()->repaint();
relation->child()->update();
}
bool childClipped(const KoShape *child) const {
......@@ -238,10 +238,10 @@ bool KoShapeContainer::childClipped(const KoShape *child) const {
}
void KoShapeContainer::repaint() const {
KoShape::repaint();
KoShape::update();
if(d->children)
foreach ( KoShape *shape, d->children->iterator())
shape->repaint();
shape->update();
}
QList<KoShape*> KoShapeContainer::iterator() const {
......
......@@ -119,7 +119,7 @@ void KoShapeManager::add( KoShape *shape, bool repaint )
d->tree.insert( br, shape );
}
if ( repaint ) {
shape->repaint();
shape->update();
}
// add the children of a KoShapeContainer
......@@ -136,7 +136,7 @@ void KoShapeManager::add( KoShape *shape, bool repaint )
void KoShapeManager::remove( KoShape *shape )
{
shape->repaint();
shape->update();
shape->removeShapeManager( this );
d->selection->deselect( shape );
d->aggregate4update.remove( shape );
......@@ -321,7 +321,7 @@ QList<KoShape *> KoShapeManager::shapesAt( const QRectF &rect, bool omitHiddenSh
return d->tree.intersects( rect );
}
void KoShapeManager::repaint( QRectF &rect, const KoShape *shape, bool selectionHandles )
void KoShapeManager::update( QRectF &rect, const KoShape *shape, bool selectionHandles )
{
d->canvas->updateCanvas( rect );
if ( selectionHandles && d->selection->isSelected( shape ) )
......
......@@ -129,7 +129,7 @@ public:
* @param selectionHandles if true; find out if the shape is selected and repaint its
* selection handles at the same time.
*/
void repaint( QRectF &rect, const KoShape *shape = 0, bool selectionHandles = false );
void update( QRectF &rect, const KoShape *shape = 0, bool selectionHandles = false );
/**
* Update the tree for finding the shapes.
......
......@@ -82,9 +82,9 @@ void KoShapeMoveStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardModi
m_canvas->clipToDocument(shape, diff);
QPointF newPos (shape->position() + diff);
m_newPositions[i] = newPos;
shape->repaint();
shape->update();
shape->setPosition(newPos);
shape->repaint();
shape->update();
i++;
}
m_canvas->shapeManager()->selection()->setPosition(m_initialSelectionPosition + m_diff);
......
......@@ -143,7 +143,7 @@ void KoShapeResizeStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardMo
int i = 0;
foreach(KoShape *shape, m_selectedShapes)
{
shape->repaint();
shape->update();
// this uses resize for the zooming part
shape->applyAbsoluteTransformation( m_unwindMatrix );
......@@ -185,7 +185,7 @@ void KoShapeResizeStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardMo
shape->applyAbsoluteTransformation( m_windMatrix );
shape->repaint();
shape->update();
i++;
}
m_canvas->shapeManager()->selection()->applyAbsoluteTransformation( matrix * m_scaleMatrix.inverted() );
......
......@@ -71,9 +71,9 @@ void KoShapeRotateStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardMo
QMatrix applyMatrix = matrix * m_rotationMatrix.inverted();
m_rotationMatrix = matrix;
foreach( KoShape * shape, m_selectedShapes ) {
shape->repaint();
shape->update();
shape->applyAbsoluteTransformation( applyMatrix );
shape->repaint();
shape->update();
}
m_canvas->shapeManager()->selection()->applyAbsoluteTransformation( applyMatrix );
}
......
......@@ -152,9 +152,9 @@ void KoShapeShearStrategy::handleMouseMove(const QPointF &point, Qt::KeyboardMod
foreach( KoShape *shape, m_selectedShapes )
{
shape->repaint();
shape->update();
shape->applyAbsoluteTransformation( applyMatrix );
shape->repaint();
shape->update();
}
m_canvas->shapeManager()->selection()->applyAbsoluteTransformation( applyMatrix );
m_shearMatrix = matrix;
......
......@@ -40,17 +40,17 @@ KoParameterHandleMoveCommand::~KoParameterHandleMoveCommand()
void KoParameterHandleMoveCommand::redo()
{
QUndoCommand::redo();
m_shape->repaint();
m_shape->update();
m_shape->moveHandle( m_handleId, m_endPoint );
m_shape->repaint();
m_shape->update();
}
/// revert the actions done in redo
void KoParameterHandleMoveCommand::undo()
{
QUndoCommand::undo();
m_shape->repaint();
m_shape->update();
m_shape->moveHandle( m_handleId, m_startPoint );
m_shape->repaint();
m_shape->update();
}
......@@ -97,7 +97,7 @@ void KoParameterToPathCommand::redo()
KoParameterShape * parameterShape = m_shapes.at( i );
parameterShape->setModified( true );
parameterShape->m_subpaths = m_newSubpaths[i];
parameterShape->repaint();
parameterShape->update();
}
m_newPointsActive = true;
}
......@@ -110,7 +110,7 @@ void KoParameterToPathCommand::undo()
KoParameterShape * parameterShape = m_shapes.at( i );
parameterShape->setModified( false );
parameterShape->m_subpaths = m_oldSubpaths[i];
parameterShape->repaint();
parameterShape->update();
}
m_newPointsActive = false;
}
......@@ -38,7 +38,7 @@ void KoPathBaseCommand::repaint( bool normalizeShapes )
{
if( normalizeShapes )
shape->normalize();
shape->repaint();
shape->update();
}
}
......@@ -113,14 +113,14 @@ void KoPathBreakAtPointCommand::redo()
{
if ( last.m_pathShape )
{
last.m_pathShape->repaint();
last.m_pathShape->update();
}
last = pd;
}
}
if ( last.m_pathShape )
{
last.m_pathShape->repaint();
last.m_pathShape->update();
}
m_deletePoints = false;
......@@ -152,14 +152,14 @@ void KoPathBreakAtPointCommand::undo()
{
if ( lastPathShape )
{
lastPathShape->repaint();
lastPathShape->update();
}
lastPathShape = pathShape;
}
}
if ( lastPathShape )
{
lastPathShape->repaint();
lastPathShape->update();
}
m_deletePoints = true;
......
......@@ -48,7 +48,7 @@ void KoPathControlPointMoveCommand::redo()
KoPathPoint * point = pathShape->pointByIndex( m_pointData.m_pointIndex );
if ( point )
{
pathShape->repaint();
pathShape->update();
if ( m_pointType == KoPathPoint::ControlPoint1 )
{
......@@ -92,7 +92,7 @@ void KoPathControlPointMoveCommand::redo()
}
pathShape->normalize();
pathShape->repaint();
pathShape->update();
}
}
......
......@@ -52,7 +52,7 @@ void KoPathFillRuleCommand::redo () {
QUndoCommand::redo();
foreach( KoPathShape *shape, d->shapes ) {
shape->setFillRule( d->newFillRule );
shape->repaint();
shape->update();
}
}
......@@ -61,7 +61,7 @@ void KoPathFillRuleCommand::undo () {
QList<Qt::FillRule>::iterator ruleIt = d->oldFillRules.begin();
foreach( KoPathShape *shape, d->shapes ) {
shape->setFillRule( *ruleIt );
shape->repaint();
shape->update();
ruleIt++;
}
}
......@@ -116,7 +116,7 @@ void KoPathPointInsertCommand::redo()
}
pathShape->insertPoint( m_points.at( i ), pointData.m_pointIndex );
pathShape->repaint();
pathShape->update();
}
m_deletePoints = false;
}
......@@ -155,7 +155,7 @@ void KoPathPointInsertCommand::undo()
qSwap( controlPoint1, m_controlPoints[i].second );
after->setControlPoint1( controlPoint1 );
}
pathShape->repaint();
pathShape->update();
}
m_deletePoints = true;
}
......
......@@ -45,14 +45,14 @@ void KoPathPointMoveCommand::redo()
matrix.translate( offset.x(), offset.y() );
// repaint old bounding rect
it.key()->repaint();
it.key()->update();
foreach( KoPathPoint *p, it.value() )
{
p->map( matrix, true );
}
it.key()->normalize();
// repaint new bounding rect
it.key()->repaint();
it.key()->update();
}
m_undoCalled = false;
}
......
......@@ -144,7 +144,7 @@ void KoPathPointRemoveCommand::redo()
for ( int i = m_pointDataList.size() - 1; i >= 0; --i )
{
const KoPathPointData &pd = m_pointDataList.at( i );
pd.m_pathShape->repaint();
pd.m_pathShape->update();
m_points[i] = pd.m_pathShape->removePoint( pd.m_pointIndex );
if ( lastPathShape != pd.m_pathShape )
......@@ -159,7 +159,7 @@ void KoPathPointRemoveCommand::redo()
{
m_points.at( j )->map( matrix );
}
lastPathShape->repaint();
lastPathShape->update();
updateBefore = i + 1;
}
lastPathShape = pd.m_pathShape;
......@@ -176,7 +176,7 @@ void KoPathPointRemoveCommand::redo()
{
m_points.at( j )->map( matrix );
}
lastPathShape->repaint();
lastPathShape->update();
}
m_deletePoints = true;
......@@ -192,7 +192,7 @@ void KoPathPointRemoveCommand::undo()
if ( lastPathShape && lastPathShape != pd.m_pathShape )
{
lastPathShape->normalize();
lastPathShape->repaint();
lastPathShape->update();
}
pd.m_pathShape->insertPoint( m_points[i], pd.m_pointIndex );
lastPathShape = pd.m_pathShape;
......@@ -200,7 +200,7 @@ void KoPathPointRemoveCommand::undo()
if ( lastPathShape )
{
lastPathShape->normalize();
lastPathShape->repaint();
lastPathShape->update();
}
m_deletePoints = false;
}
......@@ -52,12 +52,12 @@ void KoPathSegmentBreakCommand::redo()
{
QUndoCommand::redo();
// a repaint before is needed as the shape can shrink during the break
m_pointData.m_pathShape->repaint();
m_pointData.m_pathShape->update();
if ( m_startIndex.first != -1 )
{
m_startIndex = m_pointData.m_pathShape->openSubpath( m_startIndex );
m_pointData.m_pathShape->normalize();
m_pointData.m_pathShape->repaint();
m_pointData.m_pathShape->update();
}
else
{
......@@ -65,7 +65,7 @@ void KoPathSegmentBreakCommand::redo()
if ( m_broken )
{
m_pointData.m_pathShape->normalize();
m_pointData.m_pathShape->repaint();
m_pointData.m_pathShape->update();
}
}
}
......@@ -77,12 +77,12 @@ void KoPathSegmentBreakCommand::undo()
{
m_startIndex = m_pointData.m_pathShape->closeSubpath( m_startIndex );
m_pointData.m_pathShape->normalize();
m_pointData.m_pathShape->repaint();
m_pointData.m_pathShape->update();
}
else if ( m_broken )
{
m_pointData.m_pathShape->join( m_pointData.m_pointIndex.first );
m_pointData.m_pathShape->normalize();
m_pointData.m_pathShape->repaint();
m_pointData.m_pathShape->update();
}
}
......@@ -80,7 +80,7 @@ void KoPathSegmentTypeCommand::redo()
for ( ; it != m_pointDataList.end(); ++it )
{
KoPathShape * pathShape = it->m_pathShape;
pathShape->repaint();
pathShape->update();
KoPathSegment segment = pathShape->segmentByIndex( it->m_pointIndex );
......@@ -99,7 +99,7 @@ void KoPathSegmentTypeCommand::redo()
}
pathShape->normalize();
pathShape->repaint();
pathShape->update();
}
}
......@@ -109,7 +109,7 @@ void KoPathSegmentTypeCommand::undo()
for ( int i = 0; i < m_pointDataList.size(); ++i )
{
const KoPathPointData & pd = m_pointDataList.at( i );
pd.m_pathShape->repaint();
pd.m_pathShape->update();
KoPathSegment segment = pd.m_pathShape->segmentByIndex( pd.m_pointIndex );
const SegmentTypeData segmentData( m_segmentData.at( i ) );
if ( m_segmentType == Curve )
......@@ -121,7 +121,7 @@ void KoPathSegmentTypeCommand::undo()
segment.second->setProperties( segmentData.m_properties1 );
pd.m_pathShape->normalize();
pd.m_pathShape->repaint();
pd.m_pathShape->update();
}
}
......@@ -87,7 +87,7 @@ void KoPathSeparateCommand::redo()
d->controller->addShape( p );
}
foreach( KoPathShape* p, d->paths )
p->repaint();
p->update();
}
void KoPathSeparateCommand::undo()
......@@ -104,5 +104,5 @@ void KoPathSeparateCommand::undo()
d->isSeparated = false;
foreach( KoPathShape* p, d->paths )
p->repaint();
p->update();
}
......@@ -52,7 +52,7 @@ void KoShapeBackgroundCommand::redo () {
foreach( KoShape *shape, d->shapes ) {
d->oldBrushes.append( shape->background() );
shape->setBackground( d->newBrush );
shape->repaint();
shape->update();
}
}
......@@ -61,7 +61,7 @@ void KoShapeBackgroundCommand::undo () {
QList<QBrush>::iterator brushIt = d->oldBrushes.begin();
foreach( KoShape *shape, d->shapes ) {
shape->setBackground( *brushIt );
shape->repaint();
shape->update();
brushIt++;
}
}
......@@ -81,9 +81,9 @@ void KoShapeBorderCommand::redo () {
QUndoCommand::redo();
QList<KoShapeBorderModel*>::iterator borderIt = d->newBorders.begin();
foreach( KoShape *shape, d->shapes ) {
shape->repaint();
shape->update();
shape->setBorder( *borderIt );
shape->repaint();
shape->update();
++borderIt;
}
}
......@@ -92,9 +92,9 @@ void KoShapeBorderCommand::undo () {
QUndoCommand::undo();
QList<KoShapeBorderModel*>::iterator borderIt = d->oldBorders.begin();
foreach( KoShape *shape, d->shapes ) {
shape->repaint();
shape->update();
shape->setBorder( *borderIt );
shape->repaint();
shape->update();
++borderIt;
}
}
......@@ -48,18 +48,18 @@ KoShapeMoveCommand::~KoShapeMoveCommand() {
void KoShapeMoveCommand::redo() {
QUndoCommand::redo();
for(int i=0; i < d->shapes.count(); i++) {
d->shapes.at(i)->repaint();
d->shapes.at(i)->update();
d->shapes.at(i)->setPosition( d->newPositions.at(i) );
d->shapes.at(i)->repaint();
d->shapes.at(i)->update();
}
}
void KoShapeMoveCommand::undo() {
QUndoCommand::undo();
for(int i=0; i < d->shapes.count(); i++) {
d->shapes.at(i)->repaint();
d->shapes.at(i)->update();
d->shapes.at(i)->setPosition( d->previousPositions.at(i) );
d->shapes.at(i)->repaint();
d->shapes.at(i)->update();
}
}
......
......@@ -40,18 +40,18 @@ KoShapeReorderCommand::KoShapeReorderCommand(const QList<KoShape*> &shapes, QLis
void KoShapeReorderCommand::redo() {
QUndoCommand::redo();
for(int i=0; i < m_shapes.count(); i++) {
m_shapes.at(i)->repaint();
m_shapes.at(i)->update();
m_shapes.at(i)->setZIndex( m_newIndexes.at(i) );
m_shapes.at(i)->repaint();
m_shapes.at(i)->update();
}
}
void KoShapeReorderCommand::undo() {
QUndoCommand::undo();
for(int i=0; i < m_shapes.count(); i++) {
m_shapes.at(i)->repaint();
m_shapes.at(i)->update();
m_shapes.at(i)->setZIndex( m_previousIndexes.at(i) );
m_shapes.at(i)->repaint();
m_shapes.at(i)->update();
}
}
......
......@@ -37,17 +37,17 @@ KoShapeRotateCommand::KoShapeRotateCommand(const QList<KoShape*> &shapes, QList<
void KoShapeRotateCommand::redo() {
QUndoCommand::redo();
for(int i=0; i < m_shapes.count(); i++) {
m_shapes.at(i)->repaint();
m_shapes.at(i)->update();
m_shapes.at(i)->rotate( m_newAngles.at(i) );
m_shapes.at(i)->repaint();
m_shapes.at(i)->update();
}
}
void KoShapeRotateCommand::undo() {
QUndoCommand::undo();
for(int i=0; i < m_shapes.count(); i++) {
m_shapes.at(i)->repaint();
m_shapes.at(i)->update();
m_shapes.at(i)->rotate( m_previousAngles.at(i) );
m_shapes.at(i)->repaint();
m_shapes.at(i)->update();
}
}
......@@ -42,17 +42,17 @@ KoShapeShearCommand::KoShapeShearCommand(const QList<KoShape*> &shapes, QList<do
void KoShapeShearCommand::redo() {
QUndoCommand::redo();
for(int i=0; i < m_shapes.count(); i++) {
m_shapes.at(i)->repaint();
m_shapes.at(i)->update();
m_shapes.at(i)->setShear( m_newShearXs.at(i), m_newShearYs.at(i));
m_shapes.at(i)->repaint();
m_shapes.at(i)->update();
}
}
void KoShapeShearCommand::undo() {
QUndoCommand::undo();
for(int i=0; i < m_shapes.count(); i++) {
m_shapes.at(i)->repaint();
m_shapes.at(i)->update();
m_shapes.at(i)->setShear( m_previousShearXs.at(i), m_previousShearYs.at(i) );
m_shapes.at(i)->repaint();
m_shapes.at(i)->update();
}
}
......@@ -49,9 +49,9 @@ void KoShapeSizeCommand::redo () {
QUndoCommand::redo();
int i=0;
foreach(KoShape *shape, d->shapes) {
shape->repaint();
shape->update();
shape->setSize(d->newSizes[i++]);
shape->repaint();
shape->update();
}
}
......@@ -59,8 +59,8 @@ void KoShapeSizeCommand::undo () {
QUndoCommand::undo();
int i=0;
foreach(KoShape *shape, d->shapes) {
shape->repaint();
shape->update();
shape->setSize(d->previousSizes[i++]);
shape->repaint();
shape->update();
}
}
......@@ -52,9 +52,9 @@ void KoShapeTransformCommand::redo()
for( int i = 0; i < shapeCount; ++i )
{
KoShape * shape = d->shapes[i];
shape->repaint();
shape->update();
shape->setTransformation( d->newState[i] );
shape->repaint();
shape->update();
}
}
......@@ -66,8 +66,8 @@ void KoShapeTransformCommand::undo()
for( int i = 0; i < shapeCount; ++i )
{
KoShape * shape = d->shapes[i];
shape->repaint();
shape->update();
shape->setTransformation( d->oldState[i] );
shape->repaint();
shape->update();
}
}
......@@ -114,14 +114,14 @@ void KoSubpathJoinCommand::redo()