[Libreoffice-commits] core.git: cui/source

Katarina Behrens Katarina.Behrens at cib.de
Tue Nov 8 11:48:31 UTC 2016


 cui/source/inc/cuitabarea.hxx   |    4 ++--
 cui/source/tabpages/tpcolor.cxx |   36 ++++++++++++++++++++++--------------
 2 files changed, 24 insertions(+), 16 deletions(-)

New commits:
commit cc2d27ea1ef4018d0865095853e7d661f8070e1f
Author: Katarina Behrens <Katarina.Behrens at cib.de>
Date:   Mon Nov 7 16:44:27 2016 +0100

    Change new colour only, keep active one on the initial value
    
    Change-Id: Icfda455d275d0449725867fd7bf4ea3060e7dc26
    Reviewed-on: https://gerrit.libreoffice.org/30691
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Katarina Behrens <Katarina.Behrens at cib.de>

diff --git a/cui/source/inc/cuitabarea.hxx b/cui/source/inc/cuitabarea.hxx
index 362777a..a6e9f1d 100644
--- a/cui/source/inc/cuitabarea.hxx
+++ b/cui/source/inc/cuitabarea.hxx
@@ -762,10 +762,10 @@ private:
     DECL_LINK( SelectPaletteLBHdl, ListBox&, void );
     DECL_LINK( SelectValSetHdl_Impl, ValueSet*, void );
     DECL_LINK( SelectColorModeHdl_Impl, RadioButton&, void );
-    void ChangeColor(const Color &rNewColor);
+    void ChangeColor(const Color &rNewColor, bool bUpdatePreset = true);
     void SetColorModel(ColorModel eModel);
     void ChangeColorModel();
-    void UpdateColorValues();
+    void UpdateColorValues( bool bUpdatePreset = true );
     static sal_Int32 SearchColorList(OUString const & aColorName);
     DECL_LINK( ModifiedHdl_Impl, Edit&, void );
 
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 88a7e17..a823fa7 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -441,7 +441,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickWorkOnHdl_Impl, Button*, void)
     {
         Color aPreviewColor = pColorDlg->GetColor();
         aCurrentColor = aPreviewColor;
-        UpdateColorValues();
+        UpdateColorValues( false );
         // fill ItemSet and pass it on to XOut
         rXFSet.Put( XFillColorItem( OUString(), aPreviewColor ) );
         //m_pCtlPreviewOld->SetAttributes( aXFillAttr );
@@ -527,7 +527,7 @@ IMPL_LINK(SvxColorTabPage, SelectValSetHdl_Impl, ValueSet*, pValSet, void)
         rXFSet.Put( XFillColorItem( OUString(), aColor ) );
         m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() );
         m_pCtlPreviewNew->Invalidate();
-        ChangeColor(aColor);
+        ChangeColor(aColor, false);
 
         if(pValSet == m_pValSetColorList)
         {
@@ -575,11 +575,11 @@ IMPL_LINK(SvxColorTabPage, SelectColorModeHdl_Impl, RadioButton&, rRadioButton,
     UpdateColorValues();
 }
 
-void SvxColorTabPage::ChangeColor(const Color &rNewColor)
+void SvxColorTabPage::ChangeColor(const Color &rNewColor, bool bUpdatePreset )
 {
     aPreviousColor = rNewColor;
     aCurrentColor = rNewColor;
-    UpdateColorValues();
+    UpdateColorValues( bUpdatePreset );
     // fill ItemSet and pass it on to XOut
     rXFSet.Put( XFillColorItem( OUString(), aCurrentColor ) );
     m_pCtlPreviewNew->SetAttributes( aXFillAttr.GetItemSet() );
@@ -620,7 +620,7 @@ void SvxColorTabPage::ChangeColorModel()
     }
 }
 
-void SvxColorTabPage::UpdateColorValues()
+void SvxColorTabPage::UpdateColorValues( bool bUpdatePreset )
 {
     if (eCM != ColorModel::RGB)
     {
@@ -628,13 +628,17 @@ void SvxColorTabPage::UpdateColorValues()
         ConvertColorValues (aCurrentColor, eCM);
 
         m_pCcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetRed() ) );
-        m_pCpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetRed() ) );
-        m_pYcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetGreen() ) );
-        m_pYpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetGreen() ) );
         m_pMcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetBlue() ) );
-        m_pMpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetBlue() ) );
+        m_pYcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetGreen() ) );
         m_pKcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetTransparency() ) );
-        m_pKpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetTransparency() ) );
+
+        if( bUpdatePreset )
+        {
+            m_pCpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetRed() ) );
+            m_pMpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetBlue() ) );
+            m_pYpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetGreen() ) );
+            m_pKpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetTransparency() ) );
+        }
 
         ConvertColorValues (aPreviousColor, ColorModel::RGB);
         ConvertColorValues (aCurrentColor, ColorModel::RGB);
@@ -642,13 +646,17 @@ void SvxColorTabPage::UpdateColorValues()
     else
     {
         m_pRcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetRed() ) );
-        m_pRpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetRed() ) );
         m_pGcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetGreen() ) );
-        m_pGpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetGreen() ) );
         m_pBcustom->SetValue( ColorToPercent_Impl( aCurrentColor.GetBlue() ) );
-        m_pBpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetBlue() ) );
         m_pHexcustom->SetColor( aCurrentColor.GetColor() );
-        m_pHexpreset->SetColor( aPreviousColor.GetColor() );
+
+        if( bUpdatePreset )
+        {
+            m_pRpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetRed() ) );
+            m_pGpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetGreen() ) );
+            m_pBpreset->SetValue( ColorToPercent_Impl( aPreviousColor.GetBlue() ) );
+            m_pHexpreset->SetColor( aPreviousColor.GetColor() );
+        }
     }
 }
 


More information about the Libreoffice-commits mailing list