summaryrefslogtreecommitdiff
path: root/svx/source/tbxctrls
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2013-12-01 13:24:54 +0200
committerCaolán McNamara <caolanm@redhat.com>2013-12-02 11:07:00 +0000
commitaac1da796aa1fc1a01a0cd8a6fac7d668a8c259e (patch)
tree6139cd5c9e984e836167dd7056330fd657ac5cb0 /svx/source/tbxctrls
parent3348af1600ab50d8c664c1d77d46f6cf629ee2f0 (diff)
fdo#71748 Fix color pickers
This commit includes the following changes: 1) Remove boxes from PNG files, and draw them ourselves. This will ensure that the color rec will always fit the box. Also it will make all color pickers look the same, and greatly simplify the code. (a part of the code was not reachable anyway.) 2) Fix color preview for toolbar large icons. (a regression of commit f59c47fc1e79050d3342924e6173b0f4b6ddaf02.) 3) Fix sidebar paragraph color picker initial drawing. reset should be called *after* the icon assignment. Change-Id: I13ae02bc3dd68dd14877ccc949784072c58bf211 Reviewed-on: https://gerrit.libreoffice.org/6882 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit e239f372c6abcd8371d0a666c828bf1c31195dd4)
Diffstat (limited to 'svx/source/tbxctrls')
-rw-r--r--svx/source/tbxctrls/tbxcolorupdate.cxx31
1 files changed, 4 insertions, 27 deletions
diff --git a/svx/source/tbxctrls/tbxcolorupdate.cxx b/svx/source/tbxctrls/tbxcolorupdate.cxx
index 53376bf1d692..fc441874341f 100644
--- a/svx/source/tbxctrls/tbxcolorupdate.cxx
+++ b/svx/source/tbxctrls/tbxcolorupdate.cxx
@@ -126,7 +126,7 @@ namespace svx
mbWasHiContrastMode = mpTbx->GetSettings().GetStyleSettings().GetHighContrastMode();
- if( COL_TRANSPARENT != aColor.GetColor() )
+ if( ( COL_TRANSPARENT != aColor.GetColor() ) && ( maBmpSize.Width() == maBmpSize.Height() ) )
pBmpAcc->SetLineColor( aColor );
else if( mpTbx->GetBackground().GetColor().IsDark() )
pBmpAcc->SetLineColor( Color( COL_WHITE ) );
@@ -135,33 +135,10 @@ namespace svx
pBmpAcc->SetFillColor( maCurColor = aColor );
- if( maBmpSize.Width() <= 16 )
- maUpdRect = Rectangle( Point( 0,12 ), Size( maBmpSize.Width(), 4 ) );
- else if(76 == maBmpSize.Width() && 12 == maBmpSize.Height())
- {
- maUpdRect.Left() = 22;
- maUpdRect.Top() = 2;
- maUpdRect.Right() = 73;
- maUpdRect.Bottom() = 9;
- }
- else if(maBmpSize.Width() >= (2 * maBmpSize.Height() - 2) && maBmpSize.Height() >= 16)
- {
- maUpdRect.Left() = maBmpSize.Height() + 2;
- maUpdRect.Top() = 2;
- maUpdRect.Right() = maBmpSize.Width() - 3;
- maUpdRect.Bottom() = maBmpSize.Height() - 3;
- }
+ if( maBmpSize.Width() == maBmpSize.Height() )
+ maUpdRect = Rectangle( Point( 0, maBmpSize.Height() * 3 / 4 ), Size( maBmpSize.Width(), maBmpSize.Height() / 4 ) );
else
- {
- maUpdRect = Rectangle( Point( 0, 0 ), Size( maBmpSize.Width(), maBmpSize.Height() ) );
-
- // Now, fit the selected color inside the toolbox color-rectangle such that
- // the distinct boundaries of the rectangle of toolbox are also clearly visible.
- maUpdRect.Left() += 21;
- maUpdRect.Top() += 1;
- maUpdRect.Bottom() -= 1;
- maUpdRect.Right() -= 4;
- }
+ maUpdRect = Rectangle( Point( maBmpSize.Height() + 2, 2 ), Point( maBmpSize.Width() - 3, maBmpSize.Height() - 3 ) );
pBmpAcc->DrawRect( maUpdRect );