KisMirrorAxis::KisMirrorAxis(KisCanvasResourceProvider* provider, QPointer<KisView>parent) : KisCanvasDecoration("mirror_axis", parent) , d(new Private(this)) { d->resourceProvider = provider; connect(d->resourceProvider, SIGNAL(mirrorModeChanged()), SLOT(mirrorModeChanged())); d->mirrorHorizontal = d->resourceProvider->mirrorHorizontal(); d->mirrorVertical = d->resourceProvider->mirrorVertical(); d->horizontalIcon = KisIconUtils::loadIcon("mirrorAxis-HorizontalMove").pixmap(d->handleSize, QIcon::Normal, QIcon::On); d->verticalIcon = KisIconUtils::loadIcon("mirrorAxis-VerticalMove").pixmap(d->handleSize, QIcon::Normal, QIcon::On); d->horizontalHandleIcon = KisIconUtils::loadIcon("transform-move").pixmap(d->handleSize, QIcon::Normal, QIcon::On); d->verticalHandleIcon = KisIconUtils::loadIcon("transform-move").pixmap(d->handleSize, QIcon::Normal, QIcon::On); setVisible(d->mirrorHorizontal || d->mirrorVertical); int imageWidth = parent->canvasBase()->image()->width(); int imageHeight = parent->canvasBase()->image()->height(); QPointF point(imageWidth / 2, imageHeight / 2); d->resourceProvider->resourceManager()->setResource(KisCanvasResourceProvider::MirrorAxesCenter, point); parent->installEventFilter(this); KisInputManager *inputManager = parent->canvasBase()->globalInputManager(); if (inputManager) { inputManager->attachPriorityEventFilter(this); } }
void KisGridManager::setView(QPointer<KisView> imageView) { if (m_imageView) { m_gridDecoration = 0; } m_imageView = imageView; if (imageView) { m_gridDecoration = qobject_cast<KisGridDecoration*>(imageView->canvasBase()->decoration("grid").data()); if (!m_gridDecoration) { m_gridDecoration = new KisGridDecoration(imageView); imageView->canvasBase()->addDecoration(m_gridDecoration); } KisGridConfig config = imageView->document()->gridConfig(); setGridConfigImpl(config, false); emit sigRequestUpdateGridConfig(config); KisSignalsBlocker b1(m_toggleGrid, m_toggleSnapToGrid); m_toggleGrid->setChecked(config.showGrid()); m_toggleSnapToGrid->setChecked(config.snapToGrid()); } }