diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:20:29 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:20:29 +0200 |
commit | b8f13e45be884dc12884ebe8f3dcd9eecb23a106 (patch) | |
tree | 22a6d8b96815d626061ff3e2d432c13078fca5c4 /wx+/button.cpp | |
parent | 5.4 (diff) | |
download | FreeFileSync-b8f13e45be884dc12884ebe8f3dcd9eecb23a106.tar.gz FreeFileSync-b8f13e45be884dc12884ebe8f3dcd9eecb23a106.tar.bz2 FreeFileSync-b8f13e45be884dc12884ebe8f3dcd9eecb23a106.zip |
5.5
Diffstat (limited to 'wx+/button.cpp')
-rw-r--r-- | wx+/button.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/wx+/button.cpp b/wx+/button.cpp index 1e9cb7f0..0b193cfb 100644 --- a/wx+/button.cpp +++ b/wx+/button.cpp @@ -8,6 +8,7 @@ #include <algorithm> #include <limits> #include <cmath> +#include <zen/string_tools.h> #include <wx/dcmemory.h> #include <wx/image.h> #include "image_tools.h" @@ -79,7 +80,7 @@ void makeWhiteTransparent(wxImage& image) //assume black text on white backgroun unsigned char* alphaLast = alphaFirst + image.GetWidth() * image.GetHeight(); //dist(black, white) - double distBlackWhite = std::sqrt(3.0 * 255 * 255); + const double distBlackWhite = 255 * std::sqrt(3.0); const unsigned char* bytePos = image.GetData(); @@ -101,12 +102,14 @@ void makeWhiteTransparent(wxImage& image) //assume black text on white backgroun wxSize getSizeNeeded(const wxString& text, wxFont& font) { - wxCoord width, height; - wxMemoryDC dc; + const wxString& textFormatted = replaceCpy(text, L"&", L"", false); //remove accelerator + + wxCoord width = 0; + wxCoord height = 0; - wxString textFormatted = text; - textFormatted.Replace(wxT("&"), wxT(""), false); //remove accelerator + wxMemoryDC dc; dc.GetMultiLineTextExtent(textFormatted, &width, &height, nullptr, &font); + return wxSize(width, height); } @@ -138,7 +141,7 @@ wxBitmap BitmapButton::createBitmapFromText(const wxString& text) wxString textLabelFormatted = text; if ((accelPos = text.find(wxT("&"))) != wxString::npos) { - textLabelFormatted.Replace(wxT("&"), wxT(""), false); //remove accelerator + replace(textLabelFormatted, L"&", L"", false); //remove accelerator indexAccel = static_cast<int>(accelPos); } |