Commit ecf46c8b authored by Dan Leinir Turthra Jensen's avatar Dan Leinir Turthra Jensen Committed by Boudewijn Rempt

Unbreak the erase mode switch in desktop mode (and another oddity)

parent d13f26a6
......@@ -436,7 +436,7 @@ KisPaintOpPresetSP KisPaintopBox::activePreset(const KoID& paintOp)
return m_paintOpPresetMap[paintOp];
}
void KisPaintopBox::updateCompositeOp(QString compositeOpID)
void KisPaintopBox::updateCompositeOp(QString compositeOpID, bool localUpdate)
{
KisNodeSP node = m_resourceProvider->currentNode();
......@@ -458,7 +458,8 @@ void KisPaintopBox::updateCompositeOp(QString compositeOpID)
if(compositeOpID != m_currCompositeOpID) {
m_activePreset->settings()->setProperty("CompositeOp", compositeOpID);
m_optionWidget->setConfiguration(m_activePreset->settings().data());
m_resourceProvider->setCurrentCompositeOp(compositeOpID);
if(!localUpdate)
m_resourceProvider->setCurrentCompositeOp(compositeOpID);
m_prevCompositeOpID = m_currCompositeOpID;
m_currCompositeOpID = compositeOpID;
}
......@@ -536,12 +537,25 @@ void KisPaintopBox::slotCanvasResourceChanged(int /*key*/, const QVariant& /*v*/
if(preset && m_activePreset->name() != preset->name())
{
QString compositeOp = preset->settings()->getString("CompositeOp");
updateCompositeOp(compositeOp);
m_cmbCompositeOp->blockSignals(true);
m_cmbCompositeOp->selectCompositeOp(KoID(compositeOp));
m_cmbCompositeOp->blockSignals(false);
m_eraseModeButton->defaultAction()->blockSignals(true);
m_eraseModeButton->blockSignals(true);
m_eraseModeButton->setChecked(compositeOp == COMPOSITE_ERASE);
m_eraseModeButton->defaultAction()->setChecked(compositeOp == COMPOSITE_ERASE);
m_eraseModeButton->blockSignals(false);
m_eraseModeButton->defaultAction()->blockSignals(false);
resourceSelected(preset.data());
}
m_presetsChooserPopup->canvasResourceChanged(preset.data());
if(m_resourceProvider->currentCompositeOp() != m_currCompositeOpID)
updateCompositeOp(m_resourceProvider->currentCompositeOp());
if(m_resourceProvider->currentCompositeOp() != m_currCompositeOpID) {
if(!(m_resourceProvider->currentCompositeOp() == COMPOSITE_ERASE && m_eraseModeButton->isChecked() == true) &&
!(m_resourceProvider->currentCompositeOp() != COMPOSITE_ERASE && m_eraseModeButton->isChecked() == false))
updateCompositeOp(m_resourceProvider->currentCompositeOp(), true);
}
sender()->blockSignals(false);
}
}
......
......@@ -105,7 +105,7 @@ private:
KoID defaultPaintOp();
KisPaintOpPresetSP defaultPreset(const KoID& paintOp);
KisPaintOpPresetSP activePreset(const KoID& paintOp);
void updateCompositeOp(QString compositeOpID);
void updateCompositeOp(QString compositeOpID, bool localUpdate = false);
void updatePaintops(const KoColorSpace* colorSpace);
void setWidgetState(int flags);
void setSliderValue(const QString& sliderID, qreal value);
......
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