Commit cad28844 authored by Girish Ramakrishnan's avatar Girish Ramakrishnan

SVN_SILENT: Fix coding style

Somehow flake/ got left out.

svn path=/trunk/koffice/; revision=865831
parent 49c5f68b
...@@ -45,14 +45,14 @@ public: ...@@ -45,14 +45,14 @@ public:
KoSnapGuide * snapGuide; KoSnapGuide * snapGuide;
}; };
KoCanvasBase::KoCanvasBase( KoShapeControllerBase * shapeControllerBase ) KoCanvasBase::KoCanvasBase(KoShapeControllerBase * shapeControllerBase)
: d(new Private()) : d(new Private())
{ {
KConfigGroup cfg( KGlobal::config()->group("canvas") ); KConfigGroup cfg(KGlobal::config()->group("canvas"));
d->isAntialiased = cfg.readEntry("antialiasing", true); d->isAntialiased = cfg.readEntry("antialiasing", true);
d->resourceProvider = new KoCanvasResourceProvider(0); d->resourceProvider = new KoCanvasResourceProvider(0);
d->shapeController = new KoShapeController( this, shapeControllerBase ); d->shapeController = new KoShapeController(this, shapeControllerBase);
d->snapGuide = new KoSnapGuide( this ); d->snapGuide = new KoSnapGuide(this);
} }
KoCanvasBase::~KoCanvasBase() KoCanvasBase::~KoCanvasBase()
......
...@@ -50,7 +50,8 @@ class KoGuidesData; ...@@ -50,7 +50,8 @@ class KoGuidesData;
* should implement. Flake tools know about the canvas, so they can * should implement. Flake tools know about the canvas, so they can
* do things like scroll, redraw, set a cursor etc. * do things like scroll, redraw, set a cursor etc.
*/ */
class FLAKE_EXPORT KoCanvasBase { class FLAKE_EXPORT KoCanvasBase
{
public: public:
...@@ -59,7 +60,7 @@ public: ...@@ -59,7 +60,7 @@ public:
* @param shapeControllerBase the implementation of the shapeController that the * @param shapeControllerBase the implementation of the shapeController that the
* application provides to allow shapes to be added in multiple views. * application provides to allow shapes to be added in multiple views.
*/ */
explicit KoCanvasBase( KoShapeControllerBase * shapeControllerBase ); explicit KoCanvasBase(KoShapeControllerBase * shapeControllerBase);
virtual ~KoCanvasBase(); virtual ~KoCanvasBase();
public: public:
...@@ -144,7 +145,9 @@ public: ...@@ -144,7 +145,9 @@ public:
* By default the origin of the canvas widget and the position of the * By default the origin of the canvas widget and the position of the
* document origin are coincident, thus an empty point is returned. * document origin are coincident, thus an empty point is returned.
*/ */
virtual QPoint documentOrigin() const { return QPoint(0,0); } virtual QPoint documentOrigin() const {
return QPoint(0, 0);
}
/** /**
* This method should somehow call QWidget::updateMicroFocus() on the canvas widget. * This method should somehow call QWidget::updateMicroFocus() on the canvas widget.
......
This diff is collapsed.
...@@ -54,7 +54,8 @@ class KoCanvasBase; ...@@ -54,7 +54,8 @@ class KoCanvasBase;
* bottom? Now it's one config setting. * bottom? Now it's one config setting.
* *
*/ */
class FLAKE_EXPORT KoCanvasController : public QAbstractScrollArea { class FLAKE_EXPORT KoCanvasController : public QAbstractScrollArea
{
Q_OBJECT Q_OBJECT
public: public:
/// An enum to alter the positioning and size of the canvas insize the canvas controller /// An enum to alter the positioning and size of the canvas insize the canvas controller
...@@ -75,7 +76,7 @@ public: ...@@ -75,7 +76,7 @@ public:
/** /**
* Reimplemented from QAbstractScrollArea. * Reimplemented from QAbstractScrollArea.
*/ */
void scrollContentsBy ( int dx, int dy ); void scrollContentsBy(int dx, int dy);
/** /**
* Set the shadow option -- by default the canvas controller draws * Set the shadow option -- by default the canvas controller draws
...@@ -84,7 +85,7 @@ public: ...@@ -84,7 +85,7 @@ public:
* *
* @param drawShadow if true, the shadow is drawn, if false, not * @param drawShadow if true, the shadow is drawn, if false, not
*/ */
void setDrawShadow( bool drawShadow ); void setDrawShadow(bool drawShadow);
/** /**
* Set the new canvas to be shown as a child * Set the new canvas to be shown as a child
...@@ -133,7 +134,7 @@ public: ...@@ -133,7 +134,7 @@ public:
* Sets the how the canvas behaves if the zoomed document becomes smaller than the viewport. * Sets the how the canvas behaves if the zoomed document becomes smaller than the viewport.
* @param mode the new canvas mode, CanvasMode::Centered is the default value * @param mode the new canvas mode, CanvasMode::Centered is the default value
*/ */
void setCanvasMode( CanvasMode mode ); void setCanvasMode(CanvasMode mode);
/// Returns the current canvas mode /// Returns the current canvas mode
CanvasMode canvasMode() const; CanvasMode canvasMode() const;
...@@ -150,7 +151,7 @@ public: ...@@ -150,7 +151,7 @@ public:
* @param rect the rectangle to make visible * @param rect the rectangle to make visible
* @param smooth if true the viewport translation will make be just enough to ensure visibility, no more. * @param smooth if true the viewport translation will make be just enough to ensure visibility, no more.
*/ */
void ensureVisible( const QRectF &rect, bool smooth = false ); void ensureVisible(const QRectF &rect, bool smooth = false);
/** /**
* @brief Scrolls the content of the canvas so that the given shape is visible. * @brief Scrolls the content of the canvas so that the given shape is visible.
...@@ -159,7 +160,7 @@ public: ...@@ -159,7 +160,7 @@ public:
* *
* @param shape the shape to make visible * @param shape the shape to make visible
*/ */
void ensureVisible( KoShape *shape ); void ensureVisible(KoShape *shape);
/** /**
* will cause the toolOptionWidgetsChanged to be emitted and all * will cause the toolOptionWidgetsChanged to be emitted and all
...@@ -197,7 +198,7 @@ public: ...@@ -197,7 +198,7 @@ public:
* @param center the position to zoom around * @param center the position to zoom around
* @param zoom the zoom to apply * @param zoom the zoom to apply
*/ */
void zoomBy(const QPoint &center, qreal zoom ); void zoomBy(const QPoint &center, qreal zoom);
/** /**
* @brief zoom so that rect is exactly visible (as close as possible) * @brief zoom so that rect is exactly visible (as close as possible)
...@@ -224,7 +225,7 @@ public: ...@@ -224,7 +225,7 @@ public:
* Sets the preferred center point in pixels. * Sets the preferred center point in pixels.
* @param viewPoint the new preferred center * @param viewPoint the new preferred center
*/ */
void setPreferredCenter( const QPoint &viewPoint ); void setPreferredCenter(const QPoint &viewPoint);
/// Returns the currently set preferred center point in pixels /// Returns the currently set preferred center point in pixels
QPoint preferredCenter() const; QPoint preferredCenter() const;
...@@ -263,19 +264,19 @@ signals: ...@@ -263,19 +264,19 @@ signals:
* Emitted when the cursor is moved over the canvas widget. * Emitted when the cursor is moved over the canvas widget.
* @param pos the position in widget pixels. * @param pos the position in widget pixels.
*/ */
void canvasMousePositionChanged(const QPoint & pos ); void canvasMousePositionChanged(const QPoint & pos);
/** /**
* Emitted when the cursor is moved over the canvas widget. * Emitted when the cursor is moved over the canvas widget.
* @param pos the position in document coordinates. * @param pos the position in document coordinates.
*/ */
void documentMousePositionChanged(const QPointF & pos ); void documentMousePositionChanged(const QPointF & pos);
/** /**
* Emitted when the entire controller size changes * Emitted when the entire controller size changes
* @param size the size in widget pixels. * @param size the size in widget pixels.
*/ */
void sizeChanged(const QSize & size ); void sizeChanged(const QSize & size);
/** /**
* Emit the new tool option widgets to be used with this canvas. * Emit the new tool option widgets to be used with this canvas.
...@@ -288,7 +289,7 @@ signals: ...@@ -288,7 +289,7 @@ signals:
* @param point the new top-left point from which the document should * @param point the new top-left point from which the document should
* be drawn. * be drawn.
*/ */
void moveDocumentOffset( const QPoint &point ); void moveDocumentOffset(const QPoint &point);
/** /**
* Emitted when zoomTo have calculated a factor by which the zoom should change, * Emitted when zoomTo have calculated a factor by which the zoom should change,
...@@ -297,7 +298,7 @@ signals: ...@@ -297,7 +298,7 @@ signals:
* *
* @param factor by how much the zoom needs to change. * @param factor by how much the zoom needs to change.
*/ */
void zoomBy( const qreal factor ); void zoomBy(const qreal factor);
public slots: public slots:
...@@ -308,14 +309,14 @@ public slots: ...@@ -308,14 +309,14 @@ public slots:
* @param recalculateCenter if true the offset in the document we center on after calling * @param recalculateCenter if true the offset in the document we center on after calling
* recenterPreferred() will be recalculated for the new document size so the visual offset stays the same. * recenterPreferred() will be recalculated for the new document size so the visual offset stays the same.
*/ */
void setDocumentSize( const QSize &newSize, bool recalculateCenter = true); void setDocumentSize(const QSize &newSize, bool recalculateCenter = true);
/** /**
* Starts adding a new guide line. The guides tool is activated * Starts adding a new guide line. The guides tool is activated
* which then handles placing the new guide line according to the * which then handles placing the new guide line according to the
* mouse movement. * mouse movement.
*/ */
void addGuideLine( Qt::Orientation orientation, int viewPosition ); void addGuideLine(Qt::Orientation orientation, int viewPosition);
protected slots: protected slots:
...@@ -327,19 +328,19 @@ protected slots: ...@@ -327,19 +328,19 @@ protected slots:
protected: protected:
/// reimplemented from QWidget /// reimplemented from QWidget
virtual void paintEvent( QPaintEvent * event ); virtual void paintEvent(QPaintEvent * event);
/// reimplemented from QWidget /// reimplemented from QWidget
virtual void resizeEvent(QResizeEvent * resizeEvent); virtual void resizeEvent(QResizeEvent * resizeEvent);
/// reimplemented from QWidget /// reimplemented from QWidget
virtual void dragEnterEvent( QDragEnterEvent * event ); virtual void dragEnterEvent(QDragEnterEvent * event);
/// reimplemented from QWidget /// reimplemented from QWidget
virtual void dropEvent( QDropEvent *event ); virtual void dropEvent(QDropEvent *event);
/// reimplemented from QWidget /// reimplemented from QWidget
virtual void dragMoveEvent ( QDragMoveEvent *event ); virtual void dragMoveEvent(QDragMoveEvent *event);
/// reimplemented from QWidget /// reimplemented from QWidget
virtual void dragLeaveEvent( QDragLeaveEvent *event ); virtual void dragLeaveEvent(QDragLeaveEvent *event);
/// reimplemented from QWidget /// reimplemented from QWidget
virtual void wheelEvent( QWheelEvent *event ); virtual void wheelEvent(QWheelEvent *event);
/// reimplemented from QWidget /// reimplemented from QWidget
virtual void keyPressEvent(QKeyEvent *event); virtual void keyPressEvent(QKeyEvent *event);
......
This diff is collapsed.
...@@ -25,7 +25,8 @@ ...@@ -25,7 +25,8 @@
#include <QWidget> #include <QWidget>
class Viewport : public QWidget { class Viewport : public QWidget
{
Q_OBJECT Q_OBJECT
public: public:
...@@ -33,30 +34,32 @@ public: ...@@ -33,30 +34,32 @@ public:
Viewport(KoCanvasController *parent); Viewport(KoCanvasController *parent);
~Viewport() {} ~Viewport() {}
void setCanvas( QWidget *canvas ); void setCanvas(QWidget *canvas);
QWidget *canvas() { return m_canvas; } QWidget *canvas() {
void setDocumentSize( const QSize &size ); return m_canvas;
}
void setDocumentSize(const QSize &size);
/** /**
* When true, a shadow is drawn around the canvas widet. * When true, a shadow is drawn around the canvas widet.
*/ */
void setDrawShadow( bool drawShadow ); void setDrawShadow(bool drawShadow);
public slots: public slots:
void documentOffsetMoved( const QPoint &); void documentOffsetMoved(const QPoint &);
public: public:
void handleDragEnterEvent( QDragEnterEvent *event ); void handleDragEnterEvent(QDragEnterEvent *event);
void handleDropEvent( QDropEvent *event ); void handleDropEvent(QDropEvent *event);
void handleDragMoveEvent ( QDragMoveEvent *event ); void handleDragMoveEvent(QDragMoveEvent *event);
void handleDragLeaveEvent( QDragLeaveEvent *event ); void handleDragLeaveEvent(QDragLeaveEvent *event);
void handlePaintEvent( QPainter & gc, QPaintEvent *event ); void handlePaintEvent(QPainter & gc, QPaintEvent *event);
private: private:
QPointF correctPosition( const QPoint &point ) const; QPointF correctPosition(const QPoint &point) const;
void repaint( KoShape *shape ); void repaint(KoShape *shape);
/** /**
Decides whether the containing canvas widget should be as Decides whether the containing canvas widget should be as
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include <QVariant> #include <QVariant>
#include <KoColor.h> // Zut, do we want this? It's convenient, but #include <KoColor.h> // Zut, do we want this? It's convenient, but
// also makes flake dependent on pigment. (BSAR) // also makes flake dependent on pigment. (BSAR)
#include "KoShape.h" #include "KoShape.h"
class KoCanvasResourceProvider::Private class KoCanvasResourceProvider::Private
...@@ -32,11 +32,11 @@ public: ...@@ -32,11 +32,11 @@ public:
}; };
KoCanvasResourceProvider::KoCanvasResourceProvider(QObject * parent) KoCanvasResourceProvider::KoCanvasResourceProvider(QObject * parent)
: QObject( parent ), : QObject(parent),
d( new Private() ) d(new Private())
{ {
// initialize handle radius to a sane value // initialize handle radius to a sane value
setHandleRadius( 3 ); setHandleRadius(3);
} }
KoCanvasResourceProvider::~KoCanvasResourceProvider() KoCanvasResourceProvider::~KoCanvasResourceProvider()
...@@ -44,110 +44,108 @@ KoCanvasResourceProvider::~KoCanvasResourceProvider() ...@@ -44,110 +44,108 @@ KoCanvasResourceProvider::~KoCanvasResourceProvider()
delete d; delete d;
} }
void KoCanvasResourceProvider::setResource( int key, const QVariant & value ) void KoCanvasResourceProvider::setResource(int key, const QVariant & value)
{ {
if ( d->resources.contains( key ) ) { if (d->resources.contains(key)) {
d->resources[key] = value; d->resources[key] = value;
} else {
d->resources.insert(key, value);
} }
else { emit resourceChanged(key, value);
d->resources.insert( key, value );
}
emit resourceChanged( key, value );
} }
QVariant KoCanvasResourceProvider::resource(int key) QVariant KoCanvasResourceProvider::resource(int key)
{ {
if ( !d->resources.contains( key ) ) { if (!d->resources.contains(key)) {
QVariant empty; QVariant empty;
return empty; return empty;
} } else
else return d->resources.value(key);
return d->resources.value( key );
} }
void KoCanvasResourceProvider::setResource( int key, const KoColor & color ) void KoCanvasResourceProvider::setResource(int key, const KoColor & color)
{ {
QVariant v; QVariant v;
v.setValue( color ); v.setValue(color);
setResource( key, v ); setResource(key, v);
} }
void KoCanvasResourceProvider::setResource( int key, const KoID & id ) void KoCanvasResourceProvider::setResource(int key, const KoID & id)
{ {
QVariant v; QVariant v;
v.setValue( id ); v.setValue(id);
setResource( key, v ); setResource(key, v);
} }
void KoCanvasResourceProvider::setResource( int key, KoShape* shape ) void KoCanvasResourceProvider::setResource(int key, KoShape* shape)
{ {
QVariant v; QVariant v;
v.setValue( shape ); v.setValue(shape);
setResource( key, v ); setResource(key, v);
} }
KoColor KoCanvasResourceProvider::koColorResource( int key ) KoColor KoCanvasResourceProvider::koColorResource(int key)
{ {
if (! d->resources.contains(key)) { if (! d->resources.contains(key)) {
KoColor empty; KoColor empty;
return empty; return empty;
} }
return resource( key ).value<KoColor>(); return resource(key).value<KoColor>();
} }
void KoCanvasResourceProvider::setForegroundColor( const KoColor & color ) void KoCanvasResourceProvider::setForegroundColor(const KoColor & color)
{ {
setResource( KoCanvasResource::ForegroundColor, color ); setResource(KoCanvasResource::ForegroundColor, color);
} }
KoColor KoCanvasResourceProvider::foregroundColor() KoColor KoCanvasResourceProvider::foregroundColor()
{ {
return koColorResource( KoCanvasResource::ForegroundColor ); return koColorResource(KoCanvasResource::ForegroundColor);
} }
void KoCanvasResourceProvider::setBackgroundColor( const KoColor & color ) void KoCanvasResourceProvider::setBackgroundColor(const KoColor & color)
{ {
//QVariant v; //QVariant v;
//v.setValue( color ); //v.setValue( color );
setResource( KoCanvasResource::BackgroundColor, color ); setResource(KoCanvasResource::BackgroundColor, color);
} }
KoColor KoCanvasResourceProvider::backgroundColor() KoColor KoCanvasResourceProvider::backgroundColor()
{ {
return koColorResource( KoCanvasResource::BackgroundColor ); return koColorResource(KoCanvasResource::BackgroundColor);
} }
KoID KoCanvasResourceProvider::koIDResource(int key) KoID KoCanvasResourceProvider::koIDResource(int key)
{ {
return resource( key ).value<KoID>(); return resource(key).value<KoID>();
} }