summaryrefslogtreecommitdiff
path: root/wx+
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2022-10-19 10:53:07 -0400
committerB. Stack <bgstack15@gmail.com>2022-10-19 10:53:07 -0400
commita53560254596460a4778a27f50b89ce92f810055 (patch)
tree551fdc08cbece3cca567d04870b91eaa115a4675 /wx+
parentMerge branch 'b11.26' into 'master' (diff)
downloadFreeFileSync-a53560254596460a4778a27f50b89ce92f810055.tar.gz
FreeFileSync-a53560254596460a4778a27f50b89ce92f810055.tar.bz2
FreeFileSync-a53560254596460a4778a27f50b89ce92f810055.zip
add upstream 11.2711.27
Diffstat (limited to 'wx+')
-rw-r--r--wx+/graph.cpp16
-rw-r--r--wx+/graph.h6
-rw-r--r--wx+/grid.cpp12
3 files changed, 15 insertions, 19 deletions
diff --git a/wx+/graph.cpp b/wx+/graph.cpp
index bee38e36..bf30843d 100644
--- a/wx+/graph.cpp
+++ b/wx+/graph.cpp
@@ -247,7 +247,7 @@ void cutPoints(std::vector<CurvePoint>& curvePoints, std::vector<unsigned char>&
auto savePoint = [&](const CurvePoint& pt, bool markedOob) { curvePointsTmp.push_back(pt); oobMarkerTmp.push_back(markedOob); };
- bool pointInside = isInside(curvePoints[0]);
+ bool pointInside = isInside(curvePoints[0]);
if (pointInside)
savePoint(curvePoints[0], isMarkedOob(0));
@@ -282,7 +282,8 @@ void cutPoints(std::vector<CurvePoint>& curvePoints, std::vector<unsigned char>&
struct GetIntersectionX
{
- GetIntersectionX(double x) : x_(x) {}
+ explicit GetIntersectionX(double x) : x_(x) {}
+
CurvePoint operator()(const CurvePoint& from, const CurvePoint& to) const
{
const double deltaX = to.x - from.x;
@@ -296,7 +297,8 @@ private:
struct GetIntersectionY
{
- GetIntersectionY(double y) : y_(y) {}
+ explicit GetIntersectionY(double y) : y_(y) {}
+
CurvePoint operator()(const CurvePoint& from, const CurvePoint& to) const
{
const double deltaX = to.x - from.x;
@@ -524,7 +526,7 @@ void Graph2D::addCurve(const SharedRef<CurveData>& data, const CurveAttributes&
void Graph2D::render(wxDC& dc) const
{
//set label font right at the start so that it is considered by wxDC::GetTextExtent() below!
- dc.SetFont(labelFont_);
+ dc.SetFont(GetFont());
const wxRect clientRect = GetClientRect(); //DON'T use wxDC::GetSize()! DC may be larger than visible area!
@@ -634,11 +636,11 @@ void Graph2D::render(wxDC& dc) const
if (!attr_.minY || !attr_.maxY)
{
- auto itPair = std::minmax_element(points.begin(), points.end(), [](const CurvePoint& lhs, const CurvePoint& rhs) { return lhs.y < rhs.y; });
+ const auto& [itMin, itMax] = std::minmax_element(points.begin(), points.end(), [](const CurvePoint& lhs, const CurvePoint& rhs) { return lhs.y < rhs.y; });
if (!attr_.minY)
- minY = std::min(minY, itPair.first->y);
+ minY = std::min(minY, itMin->y);
if (!attr_.maxY)
- maxY = std::max(maxY, itPair.second->y);
+ maxY = std::max(maxY, itMax->y);
}
}
}
diff --git a/wx+/graph.h b/wx+/graph.h
index e9f6af32..2f73a643 100644
--- a/wx+/graph.h
+++ b/wx+/graph.h
@@ -326,11 +326,7 @@ private:
std::optional<wxBitmap> doubleBuffer_;
- using CurveList = std::vector<std::pair<SharedRef<CurveData>, CurveAttributes>>;
- CurveList curves_;
-
- //perf!!! generating the font is *very* expensive! => buffer for Graph2D::render()!
- const wxFont labelFont_{wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, L"Arial"};
+ std::vector<std::pair<SharedRef<CurveData>, CurveAttributes>> curves_;
};
}
diff --git a/wx+/grid.cpp b/wx+/grid.cpp
index 5d2adc1a..0ffee3a7 100644
--- a/wx+/grid.cpp
+++ b/wx+/grid.cpp
@@ -615,12 +615,11 @@ private:
class Grid::ColLabelWin : public SubWindow
{
public:
- explicit ColLabelWin(Grid& parent) : SubWindow(parent)
+ explicit ColLabelWin(Grid& parent) : SubWindow(parent),
+ labelFont_(GetFont().Bold())
{
//coordinate with ColLabelWin::render():
- wxFont labelFont = GetFont();
- labelFont.MakeBold();
- colLabelHeight_ = fastFromDIP(2 * DEFAULT_COL_LABEL_BORDER_DIP) + labelFont.GetPixelSize().GetHeight();
+ colLabelHeight_ = fastFromDIP(2 * DEFAULT_COL_LABEL_BORDER_DIP) + labelFont_.GetPixelSize().GetHeight();
}
int getColumnLabelHeight() const { return colLabelHeight_; }
@@ -637,9 +636,7 @@ private:
const bool enabled = renderAsEnabled(*this);
//coordinate with "colLabelHeight" in Grid constructor:
- wxFont labelFont = GetFont();
- labelFont.MakeBold();
- dc.SetFont(labelFont);
+ dc.SetFont(labelFont_);
wxDCTextColourChanger textColor(dc, wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); //use user setting for labels
@@ -944,6 +941,7 @@ private:
bool freezeMouseHighlight_ = false;
int colLabelHeight_ = 0;
+ const wxFont labelFont_;
};
//----------------------------------------------------------------------------------------------------------------
bgstack15