[Libreoffice-commits] core.git: Branch 'feature/gsoc14-colors' - svx/source

Krisztian Pinter pin.terminator at gmail.com
Fri Jul 11 10:19:34 PDT 2014


 svx/source/tbxctrls/colorwindow.hxx |    2 -
 svx/source/tbxctrls/tbcontrl.cxx    |   50 ++++++++++--------------------------
 2 files changed, 15 insertions(+), 37 deletions(-)

New commits:
commit 8056d1697e060eea0889b25e373b027d7c428c77
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Fri Jul 11 19:16:13 2014 +0200

    Move palette selection ComboBox to top of popup window
    
    Change-Id: Iff958cc8d2ef301a43db406aa38dd446bb2242a5

diff --git a/svx/source/tbxctrls/colorwindow.hxx b/svx/source/tbxctrls/colorwindow.hxx
index fd8eef7..086cdef 100644
--- a/svx/source/tbxctrls/colorwindow.hxx
+++ b/svx/source/tbxctrls/colorwindow.hxx
@@ -52,8 +52,6 @@ private:
     const sal_uInt16 nButtonHeight;
     PaletteManager& mrPaletteManager;
 
-    void UpdateGUI();
-
     DECL_LINK( SelectHdl, void * );
     DECL_LINK( SelectPaletteHdl, void *);
     DECL_LINK( OpenPickerClickHdl, void * );
diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx
index 6a307b2..cf6de14 100644
--- a/svx/source/tbxctrls/tbcontrl.cxx
+++ b/svx/source/tbxctrls/tbcontrl.cxx
@@ -100,7 +100,6 @@
 // don't make more than 15 entries visible at once
 #define MAX_STYLES_ENTRIES          static_cast< sal_uInt16 >( 15 )
 
-static void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet, sal_uInt16 nVertPadding );
 static void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize );
 
 // namespaces
@@ -1134,7 +1133,6 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     aPaletteComboBox.SetText( aPaletteList[ mrPaletteManager.GetPalette() ] );
 
     aButtonPicker.SetText("P");
-    aButtonPicker.SetSizePixel(Size(nButtonWidth, nButtonHeight));
     aButtonPicker.SetClickHdl( LINK( this, SvxColorWindow_Impl, OpenPickerClickHdl ) );
     aButtonPicker.Show();
 
@@ -1148,26 +1146,7 @@ SvxColorWindow_Impl::SvxColorWindow_Impl( const OUString&            rCommand,
     AddStatusListener( OUString( ".uno:ColorTableState" ));
     AddStatusListener( maCommand );
 
-    UpdateGUI();
-}
-
-
-void SvxColorWindow_Impl::UpdateGUI()
-{
     mrPaletteManager.ReloadColorSet(aColorSet);
-
-    const Size aNewSize(aColorSet.layoutAllVisible(mrPaletteManager.GetColorCount()));
-    aColorSet.SetOutputSizePixel(aNewSize);
-    static sal_Int32 nAdd = 4;
-
-    //TODO: Move left/right buttons above the colors
-    SetOutputSizePixel(Size(aNewSize.Width() + nAdd, aNewSize.Height() + nAdd + nButtonHeight));
-
-    aPaletteComboBox.SetPosPixel(Point(0, aNewSize.Height() + nAdd + 1));
-
-    aButtonPicker.SetPosPixel(Point(aNewSize.Width() + nAdd - nButtonWidth, aNewSize.Height() + nAdd + 1));
-
-    aPaletteComboBox.SetSizePixel(Size(aNewSize.Width() - nButtonWidth, nButtonHeight));
 }
 
 SvxColorWindow_Impl::~SvxColorWindow_Impl()
@@ -1226,7 +1205,8 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, SelectPaletteHdl)
     OUString sSrchTxt = aPaletteComboBox.GetText();
     sal_Int32 nPos = aPaletteComboBox.GetEntryPos( sSrchTxt );
     mrPaletteManager.SetPalette( nPos );
-    UpdateGUI();
+    mrPaletteManager.ReloadColorSet(aColorSet);
+    Resize();
     return 0;
 }
 
@@ -1238,7 +1218,16 @@ IMPL_LINK_NOARG(SvxColorWindow_Impl, OpenPickerClickHdl)
 
 void SvxColorWindow_Impl::Resize()
 {
-    lcl_ResizeValueSet( *this, aColorSet, nButtonHeight + 2);
+    const Size aSize(this->GetOutputSizePixel());
+    aColorSet.SetPosSizePixel( Point(2, nButtonHeight + 2), Size(aSize.Width()  - 4, aSize.Height() - 6 - nButtonHeight) );
+
+    const Size aNewSize(aColorSet.layoutAllVisible(mrPaletteManager.GetColorCount()));
+    aColorSet.SetOutputSizePixel(aNewSize);
+
+    SetOutputSizePixel(Size(aNewSize.Width() + 4, aNewSize.Height() + 4 + nButtonHeight));
+
+    aPaletteComboBox.SetPosSizePixel(Point(2, 0), Size(aNewSize.Width() - nButtonWidth, nButtonHeight));
+    aButtonPicker.SetPosSizePixel(Point(aNewSize.Width() + 4 - nButtonWidth, 0), Size(nButtonWidth, nButtonHeight));
 }
 
 void SvxColorWindow_Impl::StartSelection()
@@ -1257,7 +1246,7 @@ void SvxColorWindow_Impl::StateChanged( sal_uInt16 nSID, SfxItemState eState, co
     {
         if (( nSID == SID_COLOR_TABLE ) && ( pState->ISA( SvxColorListItem )))
         {
-            UpdateGUI();
+            mrPaletteManager.ReloadColorSet(aColorSet);
         }
         else if ( SFX_ITEM_DEFAULT <= eState )
         {
@@ -1504,7 +1493,8 @@ IMPL_LINK_NOARG(SvxFrameWindow_Impl, SelectHdl)
 
 void SvxFrameWindow_Impl::Resize()
 {
-    lcl_ResizeValueSet( *this, aFrameSet, 0 );
+    const Size aSize(this->GetOutputSizePixel());
+    aFrameSet.SetPosSizePixel(Point(2,2), Size(aSize.Width() - 4, aSize.Height() - 4));
 }
 
 
@@ -2709,16 +2699,6 @@ void SvxSimpleUndoRedoController::StateChanged( sal_uInt16, SfxItemState eState,
 
 
 
-static void lcl_ResizeValueSet( Window &rWin, ValueSet &rValueSet, sal_uInt16 nVertPadding)
-{
-    Size aSize = rWin.GetOutputSizePixel();
-    aSize.Width()  -= 4;
-    aSize.Height() -= 4 + nVertPadding;
-    rValueSet.SetPosSizePixel( Point(2,2), aSize );
-}
-
-
-
 static void lcl_CalcSizeValueSet( Window &rWin, ValueSet &rValueSet, const Size &aItemSize )
 {
     Size aSize = rValueSet.CalcWindowSizePixel( aItemSize );


More information about the Libreoffice-commits mailing list