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 1a4eae55 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Remove unused shadow parameter from KoCanvasController

(cherry picked from commit 592df8a8)
parent df6b2279
......@@ -103,15 +103,6 @@ public:
*/
virtual QSize viewportSize() const = 0;
/**
* Set the shadow option -- by default the canvas controller draws
* a black shadow around the canvas widget, which you may or may
* not want.
*
* @param drawShadow if true, the shadow is drawn, if false, not
*/
virtual void setDrawShadow(bool drawShadow) = 0;
/**
* Set the new canvas to be shown as a child
* Calling this will emit canvasRemoved() if there was a canvas before, and will emit
......@@ -454,7 +445,6 @@ public:
void scrollContentsBy(int /*dx*/, int /*dy*/) override {}
QSize viewportSize() const override { return QSize(); }
void setDrawShadow(bool /*drawShadow*/) override {}
void setCanvas(KoCanvasBase *canvas) override {Q_UNUSED(canvas)}
KoCanvasBase *canvas() const override {return 0;}
int visibleHeight() const override {return 0;}
......
......@@ -227,11 +227,6 @@ QSize KoCanvasControllerWidget::viewportSize() const
return viewport()->size();
}
void KoCanvasControllerWidget::setDrawShadow(bool drawShadow)
{
d->viewportWidget->setDrawShadow(drawShadow);
}
void KoCanvasControllerWidget::resizeEvent(QResizeEvent *resizeEvent)
{
proxyObject->emitSizeChanged(resizeEvent->size());
......
......@@ -62,8 +62,6 @@ public:
*/
virtual void activate();
void setDrawShadow(bool drawShadow) override;
void setCanvas(KoCanvasBase *canvas) override;
KoCanvasBase *canvas() const override;
......
......@@ -52,7 +52,6 @@
Viewport::Viewport(KoCanvasControllerWidget *parent)
: QWidget(parent)
, m_draggedShape(0)
, m_drawShadow(false)
, m_canvas(0)
, m_documentOffset(QPoint(0, 0))
, m_margin(0)
......@@ -91,11 +90,6 @@ void Viewport::documentOffsetMoved(const QPoint &pt)
resetLayout();
}
void Viewport::setDrawShadow(bool drawShadow)
{
m_drawShadow = drawShadow;
}
void Viewport::handleDragEnterEvent(QDragEnterEvent *event)
{
// if not a canvas set then ignore this, makes it possible to assume
......@@ -296,16 +290,6 @@ void Viewport::handleDragLeaveEvent(QDragLeaveEvent *event)
void Viewport::handlePaintEvent(QPainter &painter, QPaintEvent *event)
{
Q_UNUSED(event);
// Draw the shadow around the canvas.
if (m_parent->canvas() && m_parent->canvas()->canvasWidget() && m_drawShadow) {
QWidget *canvas = m_parent->canvas()->canvasWidget();
painter.setPen(QPen(Qt::black, 0));
QRect rect(canvas->x(), canvas->y(), canvas->width(), canvas->height());
rect.adjust(-1, -1, 0, 0);
painter.drawRect(rect);
painter.drawLine(rect.right() + 2, rect.top() + 2, rect.right() + 2, rect.bottom() + 2);
painter.drawLine(rect.left() + 2, rect.bottom() + 2, rect.right() + 2, rect.bottom() + 2);
}
if (m_draggedShape) {
const KoViewConverter *vc = m_parent->canvas()->viewConverter();
......@@ -332,67 +316,6 @@ void Viewport::resetLayout()
const int viewH = viewRect.height();
const int viewW = viewRect.width();
const int docH = m_documentSize.height();
const int docW = m_documentSize.width();
int moveX = 0;
int moveY = 0;
int resizeW = viewW;
int resizeH = viewH;
// debugFlake <<"viewH:" << viewH << endl
// << "docH: " << docH << endl
// << "viewW: " << viewW << endl
// << "docW: " << docW << endl;
if (viewH == docH && viewW == docW) {
// Do nothing
resizeW = docW;
resizeH = docH;
} else if (viewH > docH && viewW > docW) {
// Show entire canvas centered
moveX = (viewW - docW) / 2;
moveY = (viewH - docH) / 2;
resizeW = docW;
resizeH = docH;
} else if (viewW > docW) {
// Center canvas horizontally
moveX = (viewW - docW) / 2;
resizeW = docW;
int marginTop = m_margin - m_documentOffset.y();
int marginBottom = viewH - (m_documentSize.height() - m_documentOffset.y());
if (marginTop > 0) moveY = marginTop;
if (marginTop > 0) resizeH = viewH - marginTop;
if (marginBottom > 0) resizeH = viewH - marginBottom;
} else if (viewH > docH) {
// Center canvas vertically
moveY = (viewH - docH) / 2;
resizeH = docH;
int marginLeft = m_margin - m_documentOffset.x();
int marginRight = viewW - (m_documentSize.width() - m_documentOffset.x());
if (marginLeft > 0) moveX = marginLeft;
if (marginLeft > 0) resizeW = viewW - marginLeft;
if (marginRight > 0) resizeW = viewW - marginRight;
} else {
// Take care of the margin around the canvas
int marginTop = m_margin - m_documentOffset.y();
int marginLeft = m_margin - m_documentOffset.x();
int marginRight = viewW - (m_documentSize.width() - m_documentOffset.x());
int marginBottom = viewH - (m_documentSize.height() - m_documentOffset.y());
if (marginTop > 0) moveY = marginTop;
if (marginLeft > 0) moveX = marginLeft;
if (marginTop > 0) resizeH = viewH - marginTop;
if (marginLeft > 0) resizeW = viewW - marginLeft;
if (marginRight > 0) resizeW = viewW - marginRight;
if (marginBottom > 0) resizeH = viewH - marginBottom;
}
if (m_canvas) {
QRect geom = QRect(0, 0, viewW, viewH);
if (m_canvas->geometry() != geom) {
......@@ -400,10 +323,6 @@ void Viewport::resetLayout()
m_canvas->update();
}
}
if (m_drawShadow) {
update();
}
emit sizeChanged();
#if 0
debugFlake <<"View port geom:" << geometry();
......
......@@ -43,11 +43,6 @@ public:
}
void setDocumentSize(const QSize &size);
/**
* When true, a shadow is drawn around the canvas widet.
*/
void setDrawShadow(bool drawShadow);
public Q_SLOTS:
void documentOffsetMoved(const QPoint &);
......@@ -81,7 +76,6 @@ private:
KoCanvasControllerWidget *m_parent;
KoShape *m_draggedShape;
bool m_drawShadow;
QWidget *m_canvas;
QSize m_documentSize; // Size in pixels of the document
QPoint m_documentOffset; // Place where the canvas widget should
......
......@@ -235,7 +235,6 @@ KisView::KisView(KisDocument *document, KoCanvasResourceManager *resourceManager
d->canvasController.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
d->canvasController.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
d->canvasController.setDrawShadow(false);
d->canvasController.setVastScrolling(cfg.vastScrolling());
d->canvasController.setCanvas(&d->canvas);
......
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