Commit b5464301 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Rename KisViewManager::resourceProvider to canvasResourceProvider

Thus avoiding some confusion with other providers.
parent f1fdff1b
......@@ -302,7 +302,7 @@ void KisSketchView::documentChanged()
connect(d->doc, SIGNAL(modified(bool)), SIGNAL(modifiedChanged()));
QPointer<KisView> view = qobject_cast<KisView*>(KisPart::instance()->createView(d->doc,
d->viewManager->resourceProvider()->resourceManager(),
d->viewManager->canvasResourceProvider()->resourceManager(),
d->viewManager->actionCollection(),
QApplication::activeWindow()));
view->setViewManager(d->viewManager);
......
......@@ -107,11 +107,11 @@ void ColorSelectorItem::Private::commitColor(const KoColor& color, Acs::ColorRol
if (!view->canvas())
return;
KoColor currentColor = Acs::currentColor(view->resourceProvider(), role);
KoColor currentColor = Acs::currentColor(view->canvasResourceProvider(), role);
if (color == currentColor) return;
colorUpdateAllowed = false;
Acs::setCurrentColor(view->resourceProvider(), role, color);
Acs::setCurrentColor(view->canvasResourceProvider(), role, color);
QColor qcolor = selector->converter()->toQColor(currentColor);
emit q->colorChanged(qcolor, color.opacityF(), false);
colorUpdateAllowed = true;
......@@ -198,7 +198,7 @@ void ColorSelectorItem::geometryChanged(const QRectF& newGeometry, const QRectF&
// }
if (d->view) {
d->selector->setColor(Acs::currentColor(d->view->resourceProvider(), d->colorRole));
d->selector->setColor(Acs::currentColor(d->view->canvasResourceProvider(), d->colorRole));
}
d->repaintTimer->start();
......@@ -252,9 +252,9 @@ void ColorSelectorItem::setView(QObject* newView)
{
d->view = qobject_cast<KisViewManager*>( newView );
if (d->view) {
connect(d->view->resourceProvider(), SIGNAL(sigFGColorChanged(KoColor)),
connect(d->view->canvasResourceProvider(), SIGNAL(sigFGColorChanged(KoColor)),
this, SLOT(fgColorChanged(KoColor)));
connect(d->view->resourceProvider(), SIGNAL(sigBGColorChanged(KoColor)),
connect(d->view->canvasResourceProvider(), SIGNAL(sigBGColorChanged(KoColor)),
this, SLOT(bgColorChanged(KoColor)));
d->commitColor(d->currentColor, d->colorRole);
......@@ -277,7 +277,7 @@ void ColorSelectorItem::setChangeBackground(bool newChangeBackground)
return;
d->currentColor = Acs::currentColor(d->view->resourceProvider(), d->colorRole);
d->currentColor = Acs::currentColor(d->view->canvasResourceProvider(), d->colorRole);
d->main->setColor(d->currentColor);
d->sub->setColor(d->currentColor);
......
......@@ -74,7 +74,7 @@ public:
if (!view)
return;
KisNodeSP node = view->resourceProvider()->currentNode();
KisNodeSP node = view->canvasResourceProvider()->currentNode();
if (node && node->paintDevice())
{
......@@ -86,7 +86,7 @@ public:
q->setEraserMode(compositeOpID == COMPOSITE_ERASE);
currentPreset->settings()->setProperty("CompositeOp", compositeOpID);
//m_optionWidget->setConfiguration(m_activePreset->settings().data());
view->resourceProvider()->setCurrentCompositeOp(compositeOpID);
view->canvasResourceProvider()->setCurrentCompositeOp(compositeOpID);
prevCompositeOpID = currentCompositeOpID;
currentCompositeOpID = compositeOpID;
}
......@@ -113,7 +113,7 @@ public:
}
if (view)
{
view->resourceProvider()->setOpacity(opacity);
view->canvasResourceProvider()->setOpacity(opacity);
}
}
};
......@@ -316,15 +316,15 @@ void CompositeOpModel::changePaintopValue(QString propertyName, QVariant value)
bool CompositeOpModel::mirrorHorizontally() const
{
if (d->view)
return d->view->resourceProvider()->mirrorHorizontal();
return d->view->canvasResourceProvider()->mirrorHorizontal();
return false;
}
void CompositeOpModel::setMirrorHorizontally(bool newMirrorHorizontally)
{
if (d->view && d->view->resourceProvider()->mirrorHorizontal() != newMirrorHorizontally)
if (d->view && d->view->canvasResourceProvider()->mirrorHorizontal() != newMirrorHorizontally)
{
d->view->resourceProvider()->setMirrorHorizontal(newMirrorHorizontally);
d->view->canvasResourceProvider()->setMirrorHorizontal(newMirrorHorizontally);
emit mirrorHorizontallyChanged();
}
}
......@@ -332,15 +332,15 @@ void CompositeOpModel::setMirrorHorizontally(bool newMirrorHorizontally)
bool CompositeOpModel::mirrorVertically() const
{
if (d->view)
return d->view->resourceProvider()->mirrorVertical();
return d->view->canvasResourceProvider()->mirrorVertical();
return false;
}
void CompositeOpModel::setMirrorVertically(bool newMirrorVertically)
{
if (d->view && d->view->resourceProvider()->mirrorVertical() != newMirrorVertically)
if (d->view && d->view->canvasResourceProvider()->mirrorVertical() != newMirrorVertically)
{
d->view->resourceProvider()->setMirrorVertical(newMirrorVertically);
d->view->canvasResourceProvider()->setMirrorVertical(newMirrorVertically);
emit mirrorVerticallyChanged();
}
}
......@@ -391,7 +391,7 @@ void CompositeOpModel::slotToolChanged(KoCanvasController* canvas, int toolId)
void CompositeOpModel::resourceChanged(int key, const QVariant& /*v*/)
{
if (d->view && d->view->canvasBase() && d->view->canvasBase()->resourceManager() && d->view->resourceProvider()) {
if (d->view && d->view->canvasBase() && d->view->canvasBase()->resourceManager() && d->view->canvasResourceProvider()) {
if (key == KisCanvasResourceProvider::MirrorHorizontal) {
emit mirrorHorizontallyChanged();
......@@ -428,7 +428,7 @@ void CompositeOpModel::resourceChanged(int key, const QVariant& /*v*/)
d->opacity = 1;
}
d->view->resourceProvider()->setOpacity(d->opacity);
d->view->canvasResourceProvider()->setOpacity(d->opacity);
emit opacityChanged();
emit opacityEnabledChanged();
......
......@@ -70,7 +70,7 @@ public:
preset->settings()->setNode(view->resourceProvider()->currentNode());
#endif
view->resourceProvider()->setPaintOpPreset(preset);
view->canvasResourceProvider()->setPaintOpPreset(preset);
}
};
......
......@@ -1521,7 +1521,7 @@ void KisMainWindow::slotShowSessionManager() {
KoCanvasResourceProvider *KisMainWindow::resourceManager() const
{
return d->viewManager->resourceProvider()->resourceManager();
return d->viewManager->canvasResourceProvider()->resourceManager();
}
int KisMainWindow::viewCount() const
......@@ -2201,7 +2201,7 @@ void KisMainWindow::updateWindowMenu()
KisWorkspaceResource* workspace = new KisWorkspaceResource("");
workspace->setDockerState(m_this->saveState());
d->viewManager->resourceProvider()->notifySavingWorkspace(workspace);
d->viewManager->canvasResourceProvider()->notifySavingWorkspace(workspace);
workspace->setValid(true);
QString saveLocation = rserver->saveLocation();
......
......@@ -428,7 +428,7 @@ KisCanvasController *KisView::canvasController() const
KisCanvasResourceProvider *KisView::resourceProvider() const
{
if (d->viewManager) {
return d->viewManager->resourceProvider();
return d->viewManager->canvasResourceProvider();
}
return 0;
}
......
......@@ -304,7 +304,7 @@ KisViewManager::KisViewManager(QWidget *parent, KActionCollection *_actionCollec
d->controlFrame.paintopBox(), SLOT(slotToolChanged(KoCanvasController*,int)));
connect(&d->nodeManager, SIGNAL(sigNodeActivated(KisNodeSP)),
resourceProvider(), SLOT(slotNodeActivated(KisNodeSP)));
canvasResourceProvider(), SLOT(slotNodeActivated(KisNodeSP)));
connect(KisPart::instance(), SIGNAL(sigViewAdded(KisView*)), SLOT(slotViewAdded(KisView*)));
connect(KisPart::instance(), SIGNAL(sigViewRemoved(KisView*)), SLOT(slotViewRemoved(KisView*)));
......@@ -327,9 +327,9 @@ KisViewManager::KisViewManager(QWidget *parent, KActionCollection *_actionCollec
KisViewManager::~KisViewManager()
{
KisConfig cfg(false);
if (resourceProvider() && resourceProvider()->currentPreset()) {
cfg.writeKoColor("LastForeGroundColor",resourceProvider()->fgColor());
cfg.writeKoColor("LastBackGroundColor",resourceProvider()->bgColor());
if (canvasResourceProvider() && canvasResourceProvider()->currentPreset()) {
cfg.writeKoColor("LastForeGroundColor",canvasResourceProvider()->fgColor());
cfg.writeKoColor("LastBackGroundColor",canvasResourceProvider()->bgColor());
}
cfg.writeEntry("baseLength", KoResourceItemChooserSync::instance()->baseLength());
......@@ -378,8 +378,8 @@ void KisViewManager::slotViewRemoved(KisView *view)
}
KisConfig cfg(false);
if (resourceProvider() && resourceProvider()->currentPreset()) {
cfg.writeEntry("LastPreset", resourceProvider()->currentPreset()->name());
if (canvasResourceProvider() && canvasResourceProvider()->currentPreset()) {
cfg.writeEntry("LastPreset", canvasResourceProvider()->currentPreset()->name());
}
}
......@@ -503,11 +503,11 @@ void KisViewManager::setCurrentView(KisView *view)
d->viewConnections.addUniqueConnection(
image(), SIGNAL(sigSizeChanged(QPointF,QPointF)),
resourceProvider(), SLOT(slotImageSizeChanged()));
canvasResourceProvider(), SLOT(slotImageSizeChanged()));
d->viewConnections.addUniqueConnection(
image(), SIGNAL(sigResolutionChanged(double,double)),
resourceProvider(), SLOT(slotOnScreenResolutionChanged()));
canvasResourceProvider(), SLOT(slotOnScreenResolutionChanged()));
d->viewConnections.addUniqueConnection(
image(), SIGNAL(sigNodeChanged(KisNodeSP)),
......@@ -516,14 +516,14 @@ void KisViewManager::setCurrentView(KisView *view)
d->viewConnections.addUniqueConnection(
d->currentImageView->zoomManager()->zoomController(),
SIGNAL(zoomChanged(KoZoomMode::Mode,qreal)),
resourceProvider(), SLOT(slotOnScreenResolutionChanged()));
canvasResourceProvider(), SLOT(slotOnScreenResolutionChanged()));
}
d->actionManager.updateGUI();
resourceProvider()->slotImageSizeChanged();
resourceProvider()->slotOnScreenResolutionChanged();
canvasResourceProvider()->slotImageSizeChanged();
canvasResourceProvider()->slotOnScreenResolutionChanged();
Q_EMIT viewChanged();
}
......@@ -545,7 +545,7 @@ KisImageWSP KisViewManager::image() const
return 0;
}
KisCanvasResourceProvider * KisViewManager::resourceProvider()
KisCanvasResourceProvider * KisViewManager::canvasResourceProvider()
{
return &d->canvasResourceProvider;
}
......
......@@ -87,7 +87,7 @@ public: // Krita specific interfaces
/// The resource provider contains all per-view settings, such as
/// current color, current paint op etc.
KisCanvasResourceProvider *resourceProvider();
KisCanvasResourceProvider *canvasResourceProvider();
/// Return the canvasbase class
KisCanvas2 *canvasBase() const;
......
......@@ -217,7 +217,7 @@ void KisFillActionFactory::run(const QString &fillSource, KisViewManager *view)
kundo2_i18n("Flood Fill Layer"));
KisResourcesSnapshotSP resources =
new KisResourcesSnapshot(view->image(), node, view->resourceProvider()->resourceManager());
new KisResourcesSnapshot(view->image(), node, view->canvasResourceProvider()->resourceManager());
if (!fillSource.contains("opacity")) {
resources->setOpacity(1.0);
}
......@@ -241,7 +241,7 @@ void KisFillActionFactory::run(const QString &fillSource, KisViewManager *view)
applicator.end();
view->resourceProvider()->slotPainting();
view->canvasResourceProvider()->slotPainting();
}
void KisClearActionFactory::run(KisViewManager *view)
......@@ -571,9 +571,9 @@ void KisStrokeSelectionActionFactory::run(KisViewManager *view, StrokeSelectionO
QPainterPath outline = pixelSelection->outlineCache();
QColor color = params.color.toQColor();
KisNodeSP currentNode = view->resourceProvider()->resourceManager()->resource(KisCanvasResourceProvider::CurrentKritaNode).value<KisNodeWSP>();
KisNodeSP currentNode = view->canvasResourceProvider()->resourceManager()->resource(KisCanvasResourceProvider::CurrentKritaNode).value<KisNodeWSP>();
if (!currentNode->inherits("KisShapeLayer") && currentNode->paintDevice()) {
KoCanvasResourceProvider * rManager = view->resourceProvider()->resourceManager();
KoCanvasResourceProvider * rManager = view->canvasResourceProvider()->resourceManager();
KisPainter::StrokeStyle strokeStyle = KisPainter::StrokeStyleBrush;
KisPainter::FillStyle fillStyle = params.fillStyle();
......@@ -628,10 +628,10 @@ void KisStrokeBrushSelectionActionFactory::run(KisViewManager *view, StrokeSelec
pixelSelection->recalculateOutlineCache();
}
KisNodeSP currentNode = view->resourceProvider()->resourceManager()->resource(KisCanvasResourceProvider::CurrentKritaNode).value<KisNodeWSP>();
KisNodeSP currentNode = view->canvasResourceProvider()->resourceManager()->resource(KisCanvasResourceProvider::CurrentKritaNode).value<KisNodeWSP>();
if (!currentNode->inherits("KisShapeLayer") && currentNode->paintDevice())
{
KoCanvasResourceProvider * rManager = view->resourceProvider()->resourceManager();
KoCanvasResourceProvider * rManager = view->canvasResourceProvider()->resourceManager();
QPainterPath outline = pixelSelection->outlineCache();
KisPainter::StrokeStyle strokeStyle = KisPainter::StrokeStyleBrush;
KisPainter::FillStyle fillStyle = KisPainter::FillStyleNone;
......
......@@ -99,12 +99,12 @@ void KisCanvasControlsManager::transformColor(int step)
{
if (!m_view) return;
if (!m_view->canvasBase()) return;
if (!m_view->resourceProvider()->resourceManager()) return;
if (!m_view->canvasResourceProvider()->resourceManager()) return;
KConfigGroup hotkeycfg = KSharedConfig::openConfig()->group("colorhotkeys");
int steps = hotkeycfg.readEntry("steps_lightness", 10);
KoColor color = m_view->resourceProvider()->resourceManager()->resource(KoCanvasResourceProvider::ForegroundColor).value<KoColor>();
KoColor color = m_view->canvasResourceProvider()->resourceManager()->resource(KoCanvasResourceProvider::ForegroundColor).value<KoColor>();
if (color.colorSpace()->colorModelId().id()=="CMYKA" || color.colorSpace()->colorModelId().id()=="XYZA"){
QColor rgb = color.toQColor();
int h = 0, s = 0, v = 0;
......@@ -123,17 +123,17 @@ void KisCanvasControlsManager::transformColor(int step)
} else {
color.colorSpace()->increaseLuminosity(color.data(), 1.0/steps);
}
m_view->resourceProvider()->resourceManager()->setResource(KoCanvasResourceProvider::ForegroundColor, color);
m_view->canvasResourceProvider()->resourceManager()->setResource(KoCanvasResourceProvider::ForegroundColor, color);
}
void KisCanvasControlsManager::transformSaturation(int step)
{
if (!m_view) return;
if (!m_view->canvasBase()) return;
if (!m_view->resourceProvider()->resourceManager()) return;
if (!m_view->canvasResourceProvider()->resourceManager()) return;
KConfigGroup hotkeycfg = KSharedConfig::openConfig()->group("colorhotkeys");
int steps = hotkeycfg.readEntry("steps_saturation", 10);
KoColor color = m_view->resourceProvider()->resourceManager()->resource(KoCanvasResourceProvider::ForegroundColor).value<KoColor>();
KoColor color = m_view->canvasResourceProvider()->resourceManager()->resource(KoCanvasResourceProvider::ForegroundColor).value<KoColor>();
if (color.colorSpace()->colorModelId().id()=="CMYKA" || color.colorSpace()->colorModelId().id()=="XYZA"){
QColor rgb = color.toQColor();
int h = 0, s = 0, v = 0;
......@@ -147,17 +147,17 @@ void KisCanvasControlsManager::transformSaturation(int step)
} else {
color.colorSpace()->increaseSaturation(color.data(), 1.0/steps);
}
m_view->resourceProvider()->resourceManager()->setResource(KoCanvasResourceProvider::ForegroundColor, color);
m_view->canvasResourceProvider()->resourceManager()->setResource(KoCanvasResourceProvider::ForegroundColor, color);
}
void KisCanvasControlsManager::transformHue(int step)
{
if (!m_view) return;
if (!m_view->canvasBase()) return;
if (!m_view->resourceProvider()->resourceManager()) return;
if (!m_view->canvasResourceProvider()->resourceManager()) return;
KConfigGroup hotkeycfg = KSharedConfig::openConfig()->group("colorhotkeys");
int steps = hotkeycfg.readEntry("steps_hue", 36);
KoColor color = m_view->resourceProvider()->resourceManager()->resource(KoCanvasResourceProvider::ForegroundColor).value<KoColor>();
KoColor color = m_view->canvasResourceProvider()->resourceManager()->resource(KoCanvasResourceProvider::ForegroundColor).value<KoColor>();
if (color.colorSpace()->colorModelId().id()=="CMYKA" || color.colorSpace()->colorModelId().id()=="XYZA"){
QColor rgb = color.toQColor();
int h = 0, s = 0, v = 0;
......@@ -171,39 +171,39 @@ void KisCanvasControlsManager::transformHue(int step)
} else {
color.colorSpace()->decreaseHue(color.data(), 1.0/steps);
}
m_view->resourceProvider()->resourceManager()->setResource(KoCanvasResourceProvider::ForegroundColor, color);
m_view->canvasResourceProvider()->resourceManager()->setResource(KoCanvasResourceProvider::ForegroundColor, color);
}
void KisCanvasControlsManager::transformRed(int step)
{
if (!m_view) return;
if (!m_view->canvasBase()) return;
if (!m_view->resourceProvider()->resourceManager()) return;
if (!m_view->canvasResourceProvider()->resourceManager()) return;
KConfigGroup hotkeycfg = KSharedConfig::openConfig()->group("colorhotkeys");
int steps = hotkeycfg.readEntry("steps_redgreen", 10);
KoColor color = m_view->resourceProvider()->resourceManager()->resource(KoCanvasResourceProvider::ForegroundColor).value<KoColor>();
KoColor color = m_view->canvasResourceProvider()->resourceManager()->resource(KoCanvasResourceProvider::ForegroundColor).value<KoColor>();
if (step<0){
color.colorSpace()->increaseGreen(color.data(), 1.0/steps);
} else {
color.colorSpace()->increaseRed(color.data(), 1.0/steps);
}
m_view->resourceProvider()->resourceManager()->setResource(KoCanvasResourceProvider::ForegroundColor, color);
m_view->canvasResourceProvider()->resourceManager()->setResource(KoCanvasResourceProvider::ForegroundColor, color);
}
void KisCanvasControlsManager::transformBlue(int step)
{
if (!m_view) return;
if (!m_view->canvasBase()) return;
if (!m_view->resourceProvider()->resourceManager()) return;
if (!m_view->canvasResourceProvider()->resourceManager()) return;
KConfigGroup hotkeycfg = KSharedConfig::openConfig()->group("colorhotkeys");
int steps = hotkeycfg.readEntry("steps_blueyellow", 10);
KoColor color = m_view->resourceProvider()->resourceManager()->resource(KoCanvasResourceProvider::ForegroundColor).value<KoColor>();
KoColor color = m_view->canvasResourceProvider()->resourceManager()->resource(KoCanvasResourceProvider::ForegroundColor).value<KoColor>();
if (step<0){
color.colorSpace()->increaseYellow(color.data(), 1.0/steps);
} else {
color.colorSpace()->increaseBlue(color.data(), 1.0/steps);
}
m_view->resourceProvider()->resourceManager()->setResource(KoCanvasResourceProvider::ForegroundColor, color);
m_view->canvasResourceProvider()->resourceManager()->setResource(KoCanvasResourceProvider::ForegroundColor, color);
}
......@@ -256,9 +256,9 @@ void KisCanvasControlsManager::stepAlpha(float step)
{
if (!m_view) return;
if (!m_view->canvasBase()) return;
if (!m_view->resourceProvider()->resourceManager()) return;
if (!m_view->canvasResourceProvider()->resourceManager()) return;
qreal alpha = m_view->resourceProvider()->resourceManager()->resource(KisCanvasResourceProvider::Opacity).toDouble();
qreal alpha = m_view->canvasResourceProvider()->resourceManager()->resource(KisCanvasResourceProvider::Opacity).toDouble();
alpha += step;
alpha = qBound<qreal>(0.0, alpha, 1.0);
m_view->canvasBase()->resourceManager ()->setResource(KisCanvasResourceProvider::Opacity, alpha);
......
......@@ -109,20 +109,20 @@ void KisControlFrame::setup(QWidget *parent)
// XXX: KOMVC we don't have a canvas here yet, needs a setImageView
const KoColorDisplayRendererInterface *displayRenderer = \
KisDisplayColorConverter::dumbConverterInstance()->displayRendererInterface();
m_dual = new KoDualColorButton(m_viewManager->resourceProvider()->fgColor(),
m_viewManager->resourceProvider()->bgColor(), displayRenderer,
m_dual = new KoDualColorButton(m_viewManager->canvasResourceProvider()->fgColor(),
m_viewManager->canvasResourceProvider()->bgColor(), displayRenderer,
m_viewManager->mainWindow(), m_viewManager->mainWindow());
m_dual->setPopDialog(true);
action = new QWidgetAction(this);
action->setText(i18n("&Color"));
m_viewManager->actionCollection()->addAction("dual", action);
action->setDefaultWidget(m_dual);
connect(m_dual, SIGNAL(foregroundColorChanged(KoColor)), m_viewManager->resourceProvider(), SLOT(slotSetFGColor(KoColor)));
connect(m_dual, SIGNAL(backgroundColorChanged(KoColor)), m_viewManager->resourceProvider(), SLOT(slotSetBGColor(KoColor)));
connect(m_viewManager->resourceProvider(), SIGNAL(sigFGColorChanged(KoColor)), m_dual, SLOT(setForegroundColor(KoColor)));
connect(m_viewManager->resourceProvider(), SIGNAL(sigBGColorChanged(KoColor)), m_dual, SLOT(setBackgroundColor(KoColor)));
connect(m_viewManager->resourceProvider(), SIGNAL(sigFGColorChanged(KoColor)), m_gradientWidget, SLOT(update()));
connect(m_viewManager->resourceProvider(), SIGNAL(sigBGColorChanged(KoColor)), m_gradientWidget, SLOT(update()));
connect(m_dual, SIGNAL(foregroundColorChanged(KoColor)), m_viewManager->canvasResourceProvider(), SLOT(slotSetFGColor(KoColor)));
connect(m_dual, SIGNAL(backgroundColorChanged(KoColor)), m_viewManager->canvasResourceProvider(), SLOT(slotSetBGColor(KoColor)));
connect(m_viewManager->canvasResourceProvider(), SIGNAL(sigFGColorChanged(KoColor)), m_dual, SLOT(setForegroundColor(KoColor)));
connect(m_viewManager->canvasResourceProvider(), SIGNAL(sigBGColorChanged(KoColor)), m_dual, SLOT(setBackgroundColor(KoColor)));
connect(m_viewManager->canvasResourceProvider(), SIGNAL(sigFGColorChanged(KoColor)), m_gradientWidget, SLOT(update()));
connect(m_viewManager->canvasResourceProvider(), SIGNAL(sigBGColorChanged(KoColor)), m_gradientWidget, SLOT(update()));
m_dual->setFixedSize(28, 28);
connect(m_viewManager, SIGNAL(viewChanged()), SLOT(slotUpdateDisplayRenderer()));
......@@ -184,17 +184,17 @@ void KisControlFrame::createPatternsChooser(KisViewManager * view)
m_patternsTab->addTab(customPatterns, i18n("Custom Pattern"));
connect(m_patternChooser, SIGNAL(resourceSelected(KoResource*)),
view->resourceProvider(), SLOT(slotPatternActivated(KoResource*)));
view->canvasResourceProvider(), SLOT(slotPatternActivated(KoResource*)));
connect(customPatterns, SIGNAL(activatedResource(KoResource*)),
view->resourceProvider(), SLOT(slotPatternActivated(KoResource*)));
view->canvasResourceProvider(), SLOT(slotPatternActivated(KoResource*)));
connect(view->resourceProvider(), SIGNAL(sigPatternChanged(KoPattern*)),
connect(view->canvasResourceProvider(), SIGNAL(sigPatternChanged(KoPattern*)),
this, SLOT(slotSetPattern(KoPattern*)));
m_patternChooser->setCurrentItem(0, 0);
if (m_patternChooser->currentResource() && view->resourceProvider()) {
view->resourceProvider()->slotPatternActivated(m_patternChooser->currentResource());
if (m_patternChooser->currentResource() && view->canvasResourceProvider()) {
view->canvasResourceProvider()->slotPatternActivated(m_patternChooser->currentResource());
}
m_patternWidget->setPopupWidget(m_patternChooserPopup);
......@@ -225,16 +225,16 @@ void KisControlFrame::createGradientsChooser(KisViewManager * view)
m_gradientTab->addTab(m_gradientChooser, i18n("Gradients"));
connect(m_gradientChooser, SIGNAL(resourceSelected(KoResource*)),
view->resourceProvider(), SLOT(slotGradientActivated(KoResource*)));
view->canvasResourceProvider(), SLOT(slotGradientActivated(KoResource*)));
connect (view->mainWindow(), SIGNAL(themeChanged()), m_gradientChooser, SLOT(slotUpdateIcons()));
connect(view->resourceProvider(), SIGNAL(sigGradientChanged(KoAbstractGradient*)),
connect(view->canvasResourceProvider(), SIGNAL(sigGradientChanged(KoAbstractGradient*)),
this, SLOT(slotSetGradient(KoAbstractGradient*)));
m_gradientChooser->setCurrentItem(0, 0);
if (m_gradientChooser->currentResource() && view->resourceProvider())
view->resourceProvider()->slotGradientActivated(m_gradientChooser->currentResource());
if (m_gradientChooser->currentResource() && view->canvasResourceProvider())
view->canvasResourceProvider()->slotGradientActivated(m_gradientChooser->currentResource());
m_gradientWidget->setPopupWidget(m_gradientChooserPopup);
......
......@@ -277,7 +277,7 @@ void KisFilterManager::apply(KisFilterConfigurationSP filterConfig)
}
KoCanvasResourceProvider *resourceManager =
d->view->resourceProvider()->resourceManager();
d->view->canvasResourceProvider()->resourceManager();
KisResourcesSnapshotSP resources =
new KisResourcesSnapshot(image,
......
......@@ -150,7 +150,7 @@ void KisLayerManager::activateLayer(KisLayerSP layer)
emit sigLayerActivated(layer);
layersUpdated();
if (layer) {
m_view->resourceProvider()->slotNodeActivated(layer.data());
m_view->canvasResourceProvider()->slotNodeActivated(layer.data());
}
}
}
......@@ -655,7 +655,7 @@ KisAdjustmentLayerSP KisLayerManager::addAdjustmentLayer(KisNodeSP activeNode, c
KisNodeSP KisLayerManager::addGeneratorLayer(KisNodeSP activeNode)
{
KisImageWSP image = m_view->image();
QColor currentForeground = m_view->resourceProvider()->fgColor().toQColor();
QColor currentForeground = m_view->canvasResourceProvider()->fgColor().toQColor();
KisDlgGeneratorLayer dlg(image->nextLayerName(), m_view, m_view->mainWindow(), 0, 0);
......@@ -943,7 +943,7 @@ void KisLayerManager::layerStyle()
oldStyle = toQShared(new KisPSDLayerStyle());
}
KisDlgLayerStyle dlg(oldStyle->clone(), m_view->resourceProvider());
KisDlgLayerStyle dlg(oldStyle->clone(), m_view->canvasResourceProvider());
std::function<void ()> updateCall(std::bind(updateLayerStyles, layer, &dlg));
SignalToFunctionProxy proxy(updateCall);
......
......@@ -78,7 +78,7 @@ void KisMirrorManager::setView(QPointer<KisView> imageView)
connect(m_imageView->document(), SIGNAL(sigMirrorAxisConfigChanged()), this, SLOT(slotDocumentConfigChanged()), Qt::UniqueConnection);
if (!hasDecoration()) {
d->mirrorAxisDecoration = new KisMirrorAxis(m_imageView->viewManager()->resourceProvider(), m_imageView);
d->mirrorAxisDecoration = new KisMirrorAxis(m_imageView->viewManager()->canvasResourceProvider(), m_imageView);
connect(d->mirrorAxisDecoration, SIGNAL(sigConfigChanged()), this, SLOT(slotMirrorAxisConfigChanged()), Qt::UniqueConnection);
m_imageView->canvasBase()->addDecoration(d->mirrorAxisDecoration);
}
......
......@@ -87,7 +87,7 @@ typedef KoResourceServerAdapter<KisPaintOpPreset, SharedPointerStoragePolicy<Kis
KisPaintopBox::KisPaintopBox(KisViewManager *view, QWidget *parent, const char *name)
: QWidget(parent)
, m_resourceProvider(view->resourceProvider())
, m_resourceProvider(view->canvasResourceProvider())
, m_optionWidget(0)
, m_toolOptionsPopupButton(0)
, m_brushEditorPopupButton(0)
......@@ -463,7 +463,7 @@ KisPaintopBox::KisPaintopBox(KisViewManager *view, QWidget *parent, const char *
connect(m_sliderChooser[2]->getWidget<KisDoubleSliderSpinBox>("size") , SIGNAL(valueChanged(qreal)), SLOT(slotSlider3Changed()));
//Needed to connect canvas to favorite resource manager
connect(m_viewManager->resourceProvider(), SIGNAL(sigFGColorChanged(KoColor)), SLOT(slotUnsetEraseMode()));
connect(m_viewManager->canvasResourceProvider(), SIGNAL(sigFGColorChanged(KoColor)), SLOT(slotUnsetEraseMode()));
connect(m_resourceProvider, SIGNAL(sigFGColorUsed(KoColor)), m_favoriteResourceManager, SLOT(slotAddRecentColor(KoColor)));
......@@ -838,7 +838,7 @@ void KisPaintopBox::slotCanvasResourceChanged(int key, const QVariant &value)
{
if (m_viewManager) {
sender()->blockSignals(true);
KisPaintOpPresetSP preset = m_viewManager->resourceProvider()->resourceManager()->resource(KisCanvasResourceProvider::CurrentPaintOpPreset).value<KisPaintOpPresetSP>();
KisPaintOpPresetSP preset = m_viewManager->canvasResourceProvider()->resourceManager()->resource(KisCanvasResourceProvider::CurrentPaintOpPreset).value<KisPaintOpPresetSP>();
if (preset && m_resourceProvider->currentPreset()->name() != preset->name()) {
QString compositeOp = preset->settings()->getString("CompositeOp");
updateCompositeOp(compositeOp);
......
......@@ -608,7 +608,7 @@ void KisSelectionManager::paintSelectedShapes()
KisFigurePaintingToolHelper helper(actionName,
image,
paintLayer.data(),
m_view->resourceProvider()->resourceManager(),
m_view->canvasResourceProvider()->resourceManager(),
KisPainter::StrokeStyleBrush,
KisPainter::FillStyleNone);
......@@ -647,7 +647,7 @@ void KisSelectionManager::slotStrokeSelection()
return;
}
KisNodeSP currentNode = m_view->resourceProvider()->resourceManager()->resource(KisCanvasResourceProvider::CurrentKritaNode).value<KisNodeWSP>();
KisNodeSP currentNode = m_view->canvasResourceProvider()->resourceManager()->resource(KisCanvasResourceProvider::CurrentKritaNode).value<KisNodeWSP>();
bool isVectorLayer = false;
if (currentNode->inherits("KisShapeLayer")) {
isVectorLayer = true;
......
......@@ -82,7 +82,7 @@ void KisDerivedResourcesTest::test()
KisMainWindow* mainWindow = KisPart::instance()->createMainWindow();
QPointer<KisView> view = new KisView(doc, mainWindow->resourceManager(), mainWindow->actionCollection(), mainWindow);
KisViewManager *viewManager = new KisViewManager(mainWindow, mainWindow->actionCollection());
KoCanvasResourceProvider *manager = viewManager->resourceProvider()->resourceManager();
KoCanvasResourceProvider *manager = viewManager->canvasResourceProvider()->resourceManager();
QApplication::processEvents();
......
......@@ -267,7 +267,7 @@ bool KisToolFreehand::tryPickByPaintOp(KoPointerEvent *event, AlternateAction ac
*/
QPointF pos = adjustPosition(event->point, event->point);
qreal perspective = 1.0;
Q_FOREACH (const QPointer<KisAbstractPerspectiveGrid> grid, static_cast<KisCanvas2*>(canvas())->viewManager()->resourceProvider()->perspectiveGrids()) {
Q_FOREACH (const QPointer<KisAbstractPerspectiveGrid> grid, static_cast<KisCanvas2*>(canvas())->viewManager()->canvasResourceProvider()->perspectiveGrids()) {
if (grid && grid->contains(pos)) {
perspective = grid->distance(pos);
break;
......@@ -426,7 +426,7 @@ QPointF KisToolFreehand::adjustPosition(const QPointF& point, const QPointF& str
qreal KisToolFreehand::calculatePerspective(const QPointF &documentPoint)
{
qreal perspective = 1.0;
Q_FOREACH (const QPointer<KisAbstractPerspectiveGrid> grid, static_cast<KisCanvas2*>(canvas())->viewManager()->resourceProvider()->perspectiveGrids()) {
Q_FOREACH (const QPointer<KisAbstractPerspectiveGrid> grid, static_cast<KisCanvas2*>(canvas())->viewManager()->canvasResourceProvider()->perspectiveGrids()) {
if (grid && grid->contains(documentPoint)) {
perspective = grid->distance(documentPoint);
break;
......
......@@ -105,7 +105,7 @@ KisToolPaint::KisToolPaint(KoCanvasBase *canvas, const QCursor &cursor)
KisCanvas2 *kiscanvas = dynamic_cast<KisCanvas2*>(canvas);
connect(this, SIGNAL(sigPaintingFinished()), kiscanvas->viewManager()->resourceProvider(), SLOT(slotPainting()));
connect(this, SIGNAL(sigPaintingFinished()), kiscanvas->viewManager()->canvasResourceProvider(), SLOT(slotPainting()));
m_colorPickerDelayTimer.setSingleShot(true);
connect(&m_colorPickerDelayTimer, SIGNAL(timeout()), this, SLOT(activatePickColorDelayed()));
......@@ -157,7 +157,7 @@ void KisToolPaint::activate(ToolActivation toolActivation, const QSet<KoShape*>
connect(action("decrease_brush_size"), SIGNAL(triggered()), SLOT(decreaseBrushSize()), Qt::UniqueConnection);
}
KisCanvasResourceProvider *provider = qobject_cast<KisCanvas2*>(canvas())->viewManager()->resourceProvider();
KisCanvasResourceProvider *provider = qobject_cast<KisCanvas2*>(canvas())->viewManager()->canvasResourceProvider();
m_oldOpacity = provider->opacity();
provider->setOpacity(m_localOpacity);
}
......@@ -169,7 +169,7 @@ void KisToolPaint::deactivate()
disconnect(action("decrease_brush_size"), 0, this, 0);
}
KisCanvasResourceProvider *provider = qobject_cast<KisCanvas2*>(canvas())->viewManager()->resourceProvider();
KisCanvasResourceProvider *provider = qobject_cast<KisCanvas2*>(canvas())->viewManager()->canvasResourceProvider();
m_localOpacity = provider->opacity();
provider->setOpacity(m_oldOpacity);
......
......@@ -148,7 +148,7 @@ void KisWorkspaceChooser::slotSaveWorkspace()
KisWorkspaceResource* workspace = new KisWorkspaceResource(QString());
workspace->setDockerState(m_view->qtMainWindow()->saveState());
m_view->resourceProvider()->notifySavingWorkspace(workspace);
m_view->canvasResourceProvider()->notifySavingWorkspace(workspace);
workspace->setValid(true);
QString saveLocation = rserver->saveLocation();
QString name = m_workspaceWidgets.nameEdit->text();
......
......@@ -538,7 +538,7 @@ void KisAssistantTool::addAssistant()
KisAbstractPerspectiveGrid* grid = dynamic_cast<KisAbstractPerspectiveGrid*>(m_newAssistant.data());
if (grid) {
m_canvas->viewManager()->resourceProvider()->addPerspectiveGrid(grid);
m_canvas->viewManager()->canvasResourceProvider()->addPerspectiveGrid(grid);
}
m_newAssistant.clear();
}
......@@ -547,7 +547,7 @@ void KisAssistantTool::removeAssistant(KisPaintingAssistantSP assistant)
{
KisAbstractPerspectiveGrid* grid = dynamic_cast<KisAbstractPerspectiveGrid*>(assistant.data());
if (grid) {
m_canvas->viewManager()->resourceProvider()->removePerspectiveGrid(grid);
m_canvas->viewManager()->canvasResourceProvider()->removePerspectiveGrid(grid);
}
m_canvas->paintingAssistantsDecoration()->removeAssistant(assistant);
m_handles = m_canvas->paintingAssistantsDecoration()->handles();
......@@ -688,7 +688,7 @@ void KisAssistantTool::paint(QPainter& _gc, const KoViewConverter &_converter)
void KisAssistantTool::removeAllAssistants()
{
m_canvas->viewManager()->resourceProvider()->clearPerspectiveGrids();
m_canvas->viewManager()->canvasResourceProvider()->clearPerspectiveGrids();
m_canvas->paintingAssistantsDecoration()->removeAll();
m_handles = m_canvas->paintingAssistantsDecoration()->handles();
m_canvas->updateCanvas();
......@@ -799,7 +799,7 @@ void KisAssistantTool::loadAssistants()
m_canvas->paintingAssistantsDecoration()->addAssistant(assistant);
KisAbstractPerspectiveGrid* grid = dynamic_cast<KisAbstractPerspectiveGrid*>(assistant.data());
if (grid) {