diff options
author | Daniel Wilhelm <shieldwed@outlook.com> | 2018-05-09 00:04:33 +0200 |
---|---|---|
committer | Daniel Wilhelm <shieldwed@outlook.com> | 2018-05-09 00:04:33 +0200 |
commit | 017e56b81ba735c39c43701f737ac7dde55da7b4 (patch) | |
tree | ea7aaaee13a06a702701e2f74f5d390e10ae303e /wx+ | |
parent | 9.4 (diff) | |
download | FreeFileSync-017e56b81ba735c39c43701f737ac7dde55da7b4.tar.gz FreeFileSync-017e56b81ba735c39c43701f737ac7dde55da7b4.tar.bz2 FreeFileSync-017e56b81ba735c39c43701f737ac7dde55da7b4.zip |
9.5
Diffstat (limited to 'wx+')
-rwxr-xr-x | wx+/choice_enum.h | 6 | ||||
-rwxr-xr-x | wx+/dc.h | 33 | ||||
-rwxr-xr-x | wx+/graph.cpp | 121 | ||||
-rwxr-xr-x | wx+/graph.h | 28 | ||||
-rwxr-xr-x | wx+/grid.cpp | 13 | ||||
-rwxr-xr-x | wx+/grid.h | 1 | ||||
-rwxr-xr-x | wx+/image_tools.cpp | 4 | ||||
-rwxr-xr-x | wx+/popup_dlg.cpp | 2 |
8 files changed, 101 insertions, 107 deletions
diff --git a/wx+/choice_enum.h b/wx+/choice_enum.h index d564fef8..03048c43 100755 --- a/wx+/choice_enum.h +++ b/wx+/choice_enum.h @@ -19,9 +19,9 @@ Member variable: Constructor code: enumDescrMap. - add(ON_ERROR_POPUP , "Show pop-up" , "Show pop-up on errors or warnings"). <- add localization - add(ON_ERROR_IGNORE, "Ignore errors" , "Hide all error and warning messages"). - add(ON_ERROR_EXIT , "Exit instantly", "Abort synchronization immediately"); + add(ON_ERROR_POPUP, "Show pop-up", "Show pop-up on errors or warnings"). <- add localization + add(ON_ERROR_IGNORE, "Ignore errors", "Hide all error and warning messages"). + add(ON_ERROR_EXIT, "Exit instantly", "Abort synchronization immediately"); Set enum value: setEnumVal(enumDescrMap, *m_choiceHandleError, value); @@ -31,10 +31,13 @@ class BufferedPaintDC */ - - - - +inline +void clearArea(wxDC& dc, const wxRect& rect, const wxColor& col) +{ + wxDCPenChanger dummy (dc, col); + wxDCBrushChanger dummy2(dc, col); + dc.DrawRectangle(rect); +} @@ -49,10 +52,10 @@ public: auto it = refDcToAreaMap().find(&dc); if (it != refDcToAreaMap().end()) { - oldRect = it->second; + oldRect_ = it->second; wxRect tmp = r; - tmp.Intersect(*oldRect); //better safe than sorry + tmp.Intersect(*oldRect_); //better safe than sorry dc_.SetClippingRegion(tmp); // it->second = tmp; } @@ -66,10 +69,10 @@ public: ~RecursiveDcClipper() { dc_.DestroyClippingRegion(); - if (oldRect) + if (oldRect_) { - dc_.SetClippingRegion(*oldRect); - refDcToAreaMap()[&dc_] = *oldRect; + dc_.SetClippingRegion(*oldRect_); + refDcToAreaMap()[&dc_] = *oldRect_; } else refDcToAreaMap().erase(&dc_); @@ -79,7 +82,7 @@ private: //associate "active" clipping area with each DC static std::unordered_map<wxDC*, wxRect>& refDcToAreaMap() { static std::unordered_map<wxDC*, wxRect> clippingAreas; return clippingAreas; } - Opt<wxRect> oldRect; + Opt<wxRect> oldRect_; wxDC& dc_; }; @@ -95,7 +98,7 @@ struct BufferedPaintDC : public wxPaintDC { BufferedPaintDC(wxWindow& wnd, Opt<w class BufferedPaintDC : public wxMemoryDC { public: - BufferedPaintDC(wxWindow& wnd, Opt<wxBitmap>& buffer) : buffer_(buffer), paintDc(&wnd) + BufferedPaintDC(wxWindow& wnd, Opt<wxBitmap>& buffer) : buffer_(buffer), paintDc_(&wnd) { const wxSize clientSize = wnd.GetClientSize(); if (clientSize.GetWidth() > 0 && clientSize.GetHeight() > 0) //wxBitmap asserts this!! width may be 0; test case "Grid::CornerWin": compare both sides, then change config @@ -105,7 +108,7 @@ public: SelectObject(*buffer); - if (paintDc.IsOk() && paintDc.GetLayoutDirection() == wxLayout_RightToLeft) + if (paintDc_.IsOk() && paintDc_.GetLayoutDirection() == wxLayout_RightToLeft) SetLayoutDirection(wxLayout_RightToLeft); } else @@ -118,18 +121,18 @@ public: { if (GetLayoutDirection() == wxLayout_RightToLeft) { - paintDc.SetLayoutDirection(wxLayout_LeftToRight); //workaround bug in wxDC::Blit() + paintDc_.SetLayoutDirection(wxLayout_LeftToRight); //workaround bug in wxDC::Blit() SetLayoutDirection(wxLayout_LeftToRight); // } const wxPoint origin = GetDeviceOrigin(); - paintDc.Blit(0, 0, buffer_->GetWidth(), buffer_->GetHeight(), this, -origin.x, -origin.y); + paintDc_.Blit(0, 0, buffer_->GetWidth(), buffer_->GetHeight(), this, -origin.x, -origin.y); } } private: Opt<wxBitmap>& buffer_; - wxPaintDC paintDc; + wxPaintDC paintDc_; }; #endif } diff --git a/wx+/graph.cpp b/wx+/graph.cpp index 78399c3f..132361b3 100755 --- a/wx+/graph.cpp +++ b/wx+/graph.cpp @@ -200,13 +200,12 @@ void drawYLabel(wxDC& dc, double yMin, double yMax, int blockCount, const Conver } -void drawCornerText(wxDC& dc, const wxRect& graphArea, const wxString& txt, Graph2D::PosCorner pos) +void drawCornerText(wxDC& dc, const wxRect& graphArea, const wxString& txt, Graph2D::PosCorner pos, const wxColor& backgroundColor) { if (txt.empty()) return; const int borderX = 5; const int borderY = 2; //it looks like wxDC::GetMultiLineTextExtent() precisely returns width, but too large a height: maybe they consider "text row height"? - wxDCTextColourChanger dummy(dc, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); //use user setting for labels wxSize txtExtent = dc.GetMultiLineTextExtent(txt); txtExtent.x += 2 * borderX; txtExtent.y += 2 * borderY; @@ -227,6 +226,13 @@ void drawCornerText(wxDC& dc, const wxRect& graphArea, const wxString& txt, Grap drawPos.y += graphArea.height - txtExtent.GetHeight(); break; } + + { + //add text shadow to improve readability: + wxDCTextColourChanger dummy(dc, backgroundColor); + dc.DrawText(txt, drawPos + wxPoint(borderX + 1, borderY + 1)); + } + wxDCTextColourChanger dummy(dc, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); dc.DrawText(txt, drawPos + wxPoint(borderX, borderY)); } @@ -463,26 +469,26 @@ Graph2D::Graph2D(wxWindow* parent, void Graph2D::onPaintEvent(wxPaintEvent& event) { //wxAutoBufferedPaintDC dc(this); -> this one happily fucks up for RTL layout by not drawing the first column (x = 0)! - BufferedPaintDC dc(*this, doubleBuffer); + BufferedPaintDC dc(*this, doubleBuffer_); render(dc); } void Graph2D::OnMouseLeftDown(wxMouseEvent& event) { - activeSel = std::make_unique<MouseSelection>(*this, event.GetPosition()); + activeSel_ = std::make_unique<MouseSelection>(*this, event.GetPosition()); if (!event.ControlDown()) - oldSel.clear(); + oldSel_.clear(); Refresh(); } void Graph2D::OnMouseMovement(wxMouseEvent& event) { - if (activeSel.get()) + if (activeSel_.get()) { - activeSel->refCurrentPos() = event.GetPosition(); //corresponding activeSel->refSelection() is updated in Graph2D::render() + activeSel_->refCurrentPos() = event.GetPosition(); //corresponding activeSel->refSelection() is updated in Graph2D::render() Refresh(); } } @@ -490,18 +496,18 @@ void Graph2D::OnMouseMovement(wxMouseEvent& event) void Graph2D::OnMouseLeftUp(wxMouseEvent& event) { - if (activeSel.get()) + if (activeSel_.get()) { - if (activeSel->getStartPos() != activeSel->refCurrentPos()) //if it's just a single mouse click: discard selection + if (activeSel_->getStartPos() != activeSel_->refCurrentPos()) //if it's just a single mouse click: discard selection { - GraphSelectEvent selEvent(activeSel->refSelection()); //fire off GraphSelectEvent + GraphSelectEvent selEvent(activeSel_->refSelection()); //fire off GraphSelectEvent if (wxEvtHandler* handler = GetEventHandler()) handler->AddPendingEvent(selEvent); - oldSel.push_back(activeSel->refSelection()); //commit selection + oldSel_.push_back(activeSel_->refSelection()); //commit selection } - activeSel.reset(); + activeSel_.reset(); Refresh(); } } @@ -509,7 +515,7 @@ void Graph2D::OnMouseLeftUp(wxMouseEvent& event) void Graph2D::OnMouseCaptureLost(wxMouseCaptureLostEvent& event) { - activeSel.reset(); + activeSel_.reset(); Refresh(); } @@ -536,18 +542,13 @@ void Graph2D::render(wxDC& dc) const using namespace numeric; //set label font right at the start so that it is considered by wxDC::GetTextExtent() below! - dc.SetFont(labelFont); + dc.SetFont(labelFont_); const wxRect clientRect = GetClientRect(); //DON'T use wxDC::GetSize()! DC may be larger than visible area! - { - //clear complete client area; set label background color - const wxColor backCol = GetBackgroundColour(); //user-configurable! + + clearArea(dc, clientRect, GetBackgroundColour() /*user-configurable!*/); //wxPanel::GetClassDefaultAttributes().colBg : //wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE); - wxDCPenChanger dummy (dc, backCol); - wxDCBrushChanger dummy2(dc, backCol); - dc.DrawRectangle(clientRect); - } /* ----------------------- @@ -560,28 +561,28 @@ void Graph2D::render(wxDC& dc) const int xLabelPosY = clientRect.y; int yLabelPosX = clientRect.x; - switch (attr.labelposX) + switch (attr_.labelposX) { case LABEL_X_TOP: - graphArea.y += attr.xLabelHeight; - graphArea.height -= attr.xLabelHeight; + graphArea.y += attr_.xLabelHeight; + graphArea.height -= attr_.xLabelHeight; break; case LABEL_X_BOTTOM: - xLabelPosY += clientRect.height - attr.xLabelHeight; - graphArea.height -= attr.xLabelHeight; + xLabelPosY += clientRect.height - attr_.xLabelHeight; + graphArea.height -= attr_.xLabelHeight; break; case LABEL_X_NONE: break; } - switch (attr.labelposY) + switch (attr_.labelposY) { case LABEL_Y_LEFT: - graphArea.x += attr.yLabelWidth; - graphArea.width -= attr.yLabelWidth; + graphArea.x += attr_.yLabelWidth; + graphArea.width -= attr_.yLabelWidth; break; case LABEL_Y_RIGHT: - yLabelPosX += clientRect.width - attr.yLabelWidth; - graphArea.width -= attr.yLabelWidth; + yLabelPosX += clientRect.width - attr_.yLabelWidth; + graphArea.width -= attr_.yLabelWidth; break; case LABEL_Y_NONE: break; @@ -590,7 +591,7 @@ void Graph2D::render(wxDC& dc) const { //paint graph background (excluding label area) wxDCPenChanger dummy (dc, getBorderColor()); - wxDCBrushChanger dummy2(dc, attr.backgroundColor); + wxDCBrushChanger dummy2(dc, attr_.backgroundColor); //accessibility: consider system text and background colors; small drawback: color of graphs is NOT connected to the background! => responsibility of client to use correct colors dc.DrawRectangle(graphArea); @@ -598,13 +599,13 @@ void Graph2D::render(wxDC& dc) const } //set label areas respecting graph area border! - const wxRect xLabelArea(graphArea.x, xLabelPosY, graphArea.width, attr.xLabelHeight); - const wxRect yLabelArea(yLabelPosX, graphArea.y, attr.yLabelWidth, graphArea.height); + const wxRect xLabelArea(graphArea.x, xLabelPosY, graphArea.width, attr_.xLabelHeight); + const wxRect yLabelArea(yLabelPosX, graphArea.y, attr_.yLabelWidth, graphArea.height); const wxPoint graphAreaOrigin = graphArea.GetTopLeft(); //detect x value range - double minX = attr.minXauto ? std::numeric_limits<double>::infinity() : attr.minX; //automatic: ensure values are initialized by first curve - double maxX = attr.maxXauto ? -std::numeric_limits<double>::infinity() : attr.maxX; // + double minX = attr_.minXauto ? std::numeric_limits<double>::infinity() : attr_.minX; //automatic: ensure values are initialized by first curve + double maxX = attr_.maxXauto ? -std::numeric_limits<double>::infinity() : attr_.maxX; // for (auto it = curves_.begin(); it != curves_.end(); ++it) if (const CurveData* curve = it->first.get()) { @@ -612,9 +613,9 @@ void Graph2D::render(wxDC& dc) const assert(rangeX.first <= rangeX.second + 1.0e-9); //GCC fucks up badly when comparing two *binary identical* doubles and finds "begin > end" with diff of 1e-18 - if (attr.minXauto) + if (attr_.minXauto) minX = std::min(minX, rangeX.first); - if (attr.maxXauto) + if (attr_.maxXauto) maxX = std::max(maxX, rangeX.second); } @@ -624,15 +625,15 @@ void Graph2D::render(wxDC& dc) const { int blockCountX = 0; //enlarge minX, maxX to a multiple of a "useful" block size - if (attr.labelposX != LABEL_X_NONE && attr.labelFmtX.get()) + if (attr_.labelposX != LABEL_X_NONE && attr_.labelFmtX.get()) blockCountX = widenRange(minX, maxX, //in/out graphArea.width, minimalBlockSizePx.GetWidth() * 7, - *attr.labelFmtX); + *attr_.labelFmtX); //get raw values + detect y value range - double minY = attr.minYauto ? std::numeric_limits<double>::infinity() : attr.minY; //automatic: ensure values are initialized by first curve - double maxY = attr.maxYauto ? -std::numeric_limits<double>::infinity() : attr.maxY; // + double minY = attr_.minYauto ? std::numeric_limits<double>::infinity() : attr_.minY; //automatic: ensure values are initialized by first curve + double maxY = attr_.maxYauto ? -std::numeric_limits<double>::infinity() : attr_.maxY; // std::vector<std::vector<CurvePoint>> curvePoints(curves_.size()); std::vector<std::vector<char>> oobMarker (curves_.size()); //effectively a std::vector<bool> marking points that start an out-of-bounds line @@ -651,12 +652,12 @@ void Graph2D::render(wxDC& dc) const const bool doPolygonCut = curves_[index].second.fillMode == CurveAttributes::FILL_POLYGON; //impacts auto minY/maxY!! cutPointsOutsideX(points, marker, minX, maxX, doPolygonCut); - if (attr.minYauto || attr.maxYauto) + if (attr_.minYauto || attr_.maxYauto) { auto itPair = std::minmax_element(points.begin(), points.end(), [](const CurvePoint& lhs, const CurvePoint& rhs) { return lhs.y < rhs.y; }); - if (attr.minYauto) + if (attr_.minYauto) minY = std::min(minY, itPair.first->y); - if (attr.maxYauto) + if (attr_.maxYauto) maxY = std::max(maxY, itPair.second->y); } } @@ -666,11 +667,11 @@ void Graph2D::render(wxDC& dc) const { int blockCountY = 0; //enlarge minY, maxY to a multiple of a "useful" block size - if (attr.labelposY != LABEL_Y_NONE && attr.labelFmtY.get()) + if (attr_.labelposY != LABEL_Y_NONE && attr_.labelFmtY.get()) blockCountY = widenRange(minY, maxY, //in/out graphArea.height, minimalBlockSizePx.GetHeight() * 3, - *attr.labelFmtY); + *attr_.labelFmtY); if (graphArea.width <= 1 || graphArea.height <= 1) return; const ConvertCoord cvrtX(minX, maxX, graphArea.width - 1); //map [minX, maxX] to [0, pixelWidth - 1] @@ -707,7 +708,7 @@ void Graph2D::render(wxDC& dc) const } //update active mouse selection - if (activeSel.get() && graphArea.width > 0 && graphArea.height > 0) + if (activeSel_.get() && graphArea.width > 0 && graphArea.height > 0) { auto widen = [](double* low, double* high) { @@ -717,8 +718,8 @@ void Graph2D::render(wxDC& dc) const *high += 0.5; }; - const wxPoint screenStart = activeSel->getStartPos() - graphAreaOrigin; //make relative to graphArea - const wxPoint screenCurrent = activeSel->refCurrentPos() - graphAreaOrigin; + const wxPoint screenStart = activeSel_->getStartPos() - graphAreaOrigin; //make relative to graphArea + const wxPoint screenCurrent = activeSel_->refCurrentPos() - graphAreaOrigin; //normalize positions: a mouse selection is symmetric and *not* an half-open range! double screenFromX = clampCpy(screenStart .x, 0, graphArea.width - 1); @@ -729,10 +730,10 @@ void Graph2D::render(wxDC& dc) const widen(&screenFromY, &screenToY); //save current selection as "double" coordinates - activeSel->refSelection().from = CurvePoint(cvrtX.screenToReal(screenFromX), + activeSel_->refSelection().from = CurvePoint(cvrtX.screenToReal(screenFromX), cvrtY.screenToReal(screenFromY)); - activeSel->refSelection().to = CurvePoint(cvrtX.screenToReal(screenToX), + activeSel_->refSelection().to = CurvePoint(cvrtX.screenToReal(screenToX), cvrtY.screenToReal(screenToY)); } @@ -751,9 +752,9 @@ void Graph2D::render(wxDC& dc) const } //2. draw all currently set mouse selections (including active selection) - std::vector<SelectionBlock> allSelections = oldSel; - if (activeSel) - allSelections.push_back(activeSel->refSelection()); + std::vector<SelectionBlock> allSelections = oldSel_; + if (activeSel_) + allSelections.push_back(activeSel_->refSelection()); { //alpha channel not supported on wxMSW, so draw selection before curves wxDCBrushChanger dummy(dc, wxColor(168, 202, 236)); //light blue @@ -788,7 +789,7 @@ void Graph2D::render(wxDC& dc) const numeric::round(screenFromY)) + graphAreaOrigin; const wxPoint pixelTo = wxPoint(numeric::round(screenToX), numeric::round(screenToY)) + graphAreaOrigin; - switch (attr.mouseSelMode) + switch (attr_.mouseSelMode) { case SELECT_NONE: break; @@ -806,8 +807,8 @@ void Graph2D::render(wxDC& dc) const } //3. draw labels and background grid - drawXLabel(dc, minX, maxX, blockCountX, cvrtX, graphArea, xLabelArea, *attr.labelFmtX); - drawYLabel(dc, minY, maxY, blockCountY, cvrtY, graphArea, yLabelArea, *attr.labelFmtY); + drawXLabel(dc, minX, maxX, blockCountX, cvrtX, graphArea, xLabelArea, *attr_.labelFmtX); + drawYLabel(dc, minY, maxY, blockCountY, cvrtY, graphArea, yLabelArea, *attr_.labelFmtY); //4. finally draw curves { @@ -843,8 +844,8 @@ void Graph2D::render(wxDC& dc) const } //5. draw corner texts - for (const auto& ct : attr.cornerTexts) - drawCornerText(dc, graphArea, ct.second, ct.first); + for (const auto& ct : attr_.cornerTexts) + drawCornerText(dc, graphArea, ct.second, ct.first, attr_.backgroundColor); } } } diff --git a/wx+/graph.h b/wx+/graph.h index 89475611..6007ca30 100755 --- a/wx+/graph.h +++ b/wx+/graph.h @@ -27,8 +27,8 @@ Example: setLabelX(Graph2D::LABEL_X_BOTTOM, 20, std::make_shared<LabelFormatterTimeElapsed>()). setLabelY(Graph2D::LABEL_Y_RIGHT, 60, std::make_shared<LabelFormatterBytes>())); //set graph data - std::shared_ptr<CurveData> curveDataBytes = ... - m_panelGraph->setCurve(curveDataBytes, Graph2D::CurveAttributes().setLineWidth(2).setColor(wxColor(0, 192, 0))); + std::shared_ptr<CurveData> curveDataBytes_ = ... + m_panelGraph->setCurve(curveDataBytes_, Graph2D::CurveAttributes().setLineWidth(2).setColor(wxColor(0, 192, 0))); */ struct CurvePoint @@ -78,7 +78,7 @@ struct ArrayCurveData : public SparseCurveData virtual size_t getSize () const = 0; private: - std::pair<double, double> getRangeX() const override { const size_t sz = getSize(); return std::make_pair(0.0, sz == 0 ? 0.0 : sz - 1.0); } + std::pair<double, double> getRangeX() const override { const size_t sz = getSize(); return { 0.0, sz == 0 ? 0.0 : sz - 1.0}; } Opt<CurvePoint> getLessEq(double x) const override { @@ -295,17 +295,17 @@ public: wxColor backgroundColor = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); SelMode mouseSelMode = SELECT_RECTANGLE; }; - void setAttributes(const MainAttributes& newAttr) { attr = newAttr; Refresh(); } - MainAttributes getAttributes() const { return attr; } + void setAttributes(const MainAttributes& newAttr) { attr_ = newAttr; Refresh(); } + MainAttributes getAttributes() const { return attr_; } - std::vector<SelectionBlock> getSelections() const { return oldSel; } + std::vector<SelectionBlock> getSelections() const { return oldSel_; } void setSelections(const std::vector<SelectionBlock>& sel) { - oldSel = sel; - activeSel.reset(); + oldSel_ = sel; + activeSel_.reset(); Refresh(); } - void clearSelection() { oldSel.clear(); Refresh(); } + void clearSelection() { oldSel_.clear(); Refresh(); } private: void OnMouseLeftDown(wxMouseEvent& event); @@ -336,18 +336,18 @@ private: wxPoint posDragCurrent; SelectionBlock selBlock; }; - std::vector<SelectionBlock> oldSel; //applied selections - std::shared_ptr<MouseSelection> activeSel; //set during mouse selection + std::vector<SelectionBlock> oldSel_; //applied selections + std::shared_ptr<MouseSelection> activeSel_; //set during mouse selection - MainAttributes attr; //global attributes + MainAttributes attr_; //global attributes - Opt<wxBitmap> doubleBuffer; + Opt<wxBitmap> doubleBuffer_; using CurveList = std::vector<std::pair<std::shared_ptr<CurveData>, CurveAttributes>>; CurveList curves_; //perf!!! generating the font is *very* expensive! don't do this repeatedly in Graph2D::render()! - const wxFont labelFont { wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, L"Arial" }; + const wxFont labelFont_ { wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, L"Arial" }; }; } diff --git a/wx+/grid.cpp b/wx+/grid.cpp index 1d67d8ad..6652ec56 100755 --- a/wx+/grid.cpp +++ b/wx+/grid.cpp @@ -13,10 +13,10 @@ #include <wx/tooltip.h> #include <wx/timer.h> #include <wx/utils.h> -//#include <zen/tick_count.h> #include <zen/string_tools.h> #include <zen/scope_guard.h> #include <zen/utf.h> +#include <zen/zstring.h> #include <zen/format_unit.h> #include "dc.h" @@ -31,14 +31,6 @@ wxColor Grid::getColorSelectionGradientTo () { return { 225, 234, 255 }; } // const int GridData::COLUMN_GAP_LEFT = 4; -void zen::clearArea(wxDC& dc, const wxRect& rect, const wxColor& col) -{ - wxDCPenChanger dummy (dc, col); - wxDCBrushChanger dummy2(dc, col); - dc.DrawRectangle(rect); -} - - namespace { //let's NOT create wxWidgets objects statically: @@ -136,7 +128,6 @@ wxSize GridData::drawCellText(wxDC& dc, const wxRect& rect, const std::wstring& //truncate large texts and add ellipsis assert(!contains(text, L"\n")); - const wchar_t ELLIPSIS = L'\u2026'; //"..." std::wstring textTrunc = text; wxSize extentTrunc = dc.GetTextExtent(textTrunc); @@ -476,7 +467,7 @@ public: } private: - static std::wstring formatRow(size_t row) { return toGuiString(row + 1); } //convert number to std::wstring including thousands separator + static std::wstring formatRow(size_t row) { return formatNumber(row + 1); } //convert number to std::wstring including thousands separator bool AcceptsFocus() const override { return false; } @@ -91,7 +91,6 @@ using GridColumnResizeEventFunction = void (wxEvtHandler::*)(GridColumnResizeEve //------------------------------------------------------------------------------------------------------------ class Grid; -void clearArea(wxDC& dc, const wxRect& rect, const wxColor& col); class GridData { diff --git a/wx+/image_tools.cpp b/wx+/image_tools.cpp index bb5cd6c3..1e63346a 100755 --- a/wx+/image_tools.cpp +++ b/wx+/image_tools.cpp @@ -6,6 +6,7 @@ #include "image_tools.h" #include <zen/string_tools.h> +#include <zen/zstring.h> #include <wx/app.h> @@ -150,9 +151,8 @@ wxImage zen::createImageFromText(const wxString& text, const wxFont& font, const //for some reason wxDC::DrawText messes up "weak" bidi characters even when wxLayout_RightToLeft is set! (--> arrows in hebrew/arabic) //=> use mark characters instead: - const wchar_t rtlMark = L'\u200F'; //UTF-8: E2 80 8F if (wxTheApp->GetLayoutDirection() == wxLayout_RightToLeft) - textFmt = rtlMark + textFmt + rtlMark; + textFmt = RTL_MARK + textFmt + RTL_MARK; const std::vector<std::pair<wxString, wxSize>> lineInfo = getTextExtentInfo(textFmt, font); diff --git a/wx+/popup_dlg.cpp b/wx+/popup_dlg.cpp index 19c721ad..1d18be5e 100755 --- a/wx+/popup_dlg.cpp +++ b/wx+/popup_dlg.cpp @@ -114,7 +114,7 @@ public: if (parent && parent->IsShownOnScreen()) SetTitle(titleTmp); else - SetTitle(wxTheApp->GetAppDisplayName() + L" - " + titleTmp); + SetTitle(wxTheApp->GetAppDisplayName() + SPACED_DASH + titleTmp); } int maxWidth = 500; |