[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra] krita/ui: Separate the opacity of the presets from the opacity of the gradient and fill t
From:       Silvio Heinrich <plassy () web ! de>
Date:       2012-01-27 8:43:33
Message-ID: 20120127084333.570E2A60A6 () git ! kde ! org
[Download RAW message or body]

Git commit 4bf7219e116d57e1e8e0585616e57f730ebb1049 by Silvio Heinrich.
Committed on 27/01/2012 at 09:36.
Pushed by heinrich into branch 'master'.

Separate the opacity of the presets from the opacity of the gradient and fill tool \
when they are selected.

CCBUG:288218

M  +26   -15   krita/ui/kis_paintop_box.cc
M  +1    -0    krita/ui/kis_paintop_box.h

http://commits.kde.org/calligra/4bf7219e116d57e1e8e0585616e57f730ebb1049

diff --git a/krita/ui/kis_paintop_box.cc b/krita/ui/kis_paintop_box.cc
index c1928c8..0847e86 100644
--- a/krita/ui/kis_paintop_box.cc
+++ b/krita/ui/kis_paintop_box.cc
@@ -80,6 +80,7 @@ KisPaintopBox::KisPaintopBox(KisView2 * view, QWidget *parent, \
const char * name  , m_activePreset(0)
     , m_previousNode(0)
     , m_currTabletToolID(KoToolManager::instance()->currentInputDevice())
+    , m_presetsEnabled(true)
 {
     Q_ASSERT(view != 0);
 
@@ -629,19 +630,22 @@ void KisPaintopBox::sliderChanged(int n)
     setSliderValue("opacity", opacity);
     setSliderValue("flow"   , flow   );
     setSliderValue("size"   , size   );
-    
-    // IMPORTANT: set the PaintOp size before setting the other properties
-    //            it wont work the other way
-    qreal sizeDiff = size - m_activePreset->settings()->paintOpSize().width();
-    m_activePreset->settings()->changePaintOpSize(sizeDiff, 0);
-    
-    if(m_activePreset->settings()->hasProperty("OpacityValue"))
-        m_activePreset->settings()->setProperty("OpacityValue", opacity);
-    
-    if(m_activePreset->settings()->hasProperty("FlowValue"))
-        m_activePreset->settings()->setProperty("FlowValue", flow);
-    
-    m_optionWidget->setConfiguration(m_activePreset->settings().data());
+
+    if(m_presetsEnabled) {
+        // IMPORTANT: set the PaintOp size before setting the other properties
+        //            it wont work the other way
+        qreal sizeDiff = size - m_activePreset->settings()->paintOpSize().width();
+        m_activePreset->settings()->changePaintOpSize(sizeDiff, 0);
+
+        if(m_activePreset->settings()->hasProperty("OpacityValue"))
+            m_activePreset->settings()->setProperty("OpacityValue", opacity);
+
+        if(m_activePreset->settings()->hasProperty("FlowValue"))
+            m_activePreset->settings()->setProperty("FlowValue", flow);
+
+        m_optionWidget->setConfiguration(m_activePreset->settings().data());
+    }
+    else m_resourceProvider->setOpacity(opacity);
 }
 
 void KisPaintopBox::slotSlider1Changed()
@@ -668,8 +672,15 @@ void KisPaintopBox::slotToolChanged(KoCanvasController* canvas, \
                int toolId)
         if(flags & KisTool::FLAG_USES_CUSTOM_COMPOSITEOP) { \
                setWidgetState(ENABLE_COMPOSITEOP|ENABLE_OPACITY);   }
         else                                              { \
setWidgetState(DISABLE_COMPOSITEOP|DISABLE_OPACITY); }  
-        if(flags & KisTool::FLAG_USES_CUSTOM_PRESET) { \
                setWidgetState(ENABLE_PRESETS|ENABLE_SIZE|ENABLE_FLOW);    }
-        else                                         { \
setWidgetState(DISABLE_PRESETS|DISABLE_SIZE|DISABLE_FLOW); } +        if(flags & \
KisTool::FLAG_USES_CUSTOM_PRESET) { +            \
setWidgetState(ENABLE_PRESETS|ENABLE_SIZE|ENABLE_FLOW); +            \
slotUpdatePreset(); +            m_presetsEnabled = true;
+        }
+        else {
+            setWidgetState(DISABLE_PRESETS|DISABLE_SIZE|DISABLE_FLOW);
+            m_presetsEnabled = false;
+        }
     }
     else setWidgetState(DISABLE_ALL);
 }
diff --git a/krita/ui/kis_paintop_box.h b/krita/ui/kis_paintop_box.h
index 41b7a1b..04a665d 100644
--- a/krita/ui/kis_paintop_box.h
+++ b/krita/ui/kis_paintop_box.h
@@ -182,6 +182,7 @@ private:
     TabletToolMap    m_tabletToolMap;
     PaintOpPresetMap m_paintOpPresetMap;
     TabletToolID     m_currTabletToolID;
+    bool             m_presetsEnabled;
 };
 
 #endif //KIS_PAINTOP_BOX_H_


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic