summaryrefslogtreecommitdiff
path: root/wx+/grid.cpp
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2018-11-15 11:22:00 +0000
committerB Stack <bgstack15@gmail.com>2018-11-15 11:22:00 +0000
commit77c5c2503d459288720a8894349ac74e5eeec7c6 (patch)
tree30bf08d782d58174a0ca212b2e4b172fabd9c42c /wx+/grid.cpp
parentMerge branch '10.5' into 'master' (diff)
parent10.6 (diff)
downloadFreeFileSync-77c5c2503d459288720a8894349ac74e5eeec7c6.tar.gz
FreeFileSync-77c5c2503d459288720a8894349ac74e5eeec7c6.tar.bz2
FreeFileSync-77c5c2503d459288720a8894349ac74e5eeec7c6.zip
Merge branch '10.6' into 'master'10.6
10.6 See merge request opensource-tracking/FreeFileSync!3
Diffstat (limited to 'wx+/grid.cpp')
-rwxr-xr-xwx+/grid.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/wx+/grid.cpp b/wx+/grid.cpp
index 65311ffa..3c19c246 100755
--- a/wx+/grid.cpp
+++ b/wx+/grid.cpp
@@ -171,7 +171,6 @@ wxSize GridData::drawCellText(wxDC& dc, const wxRect& rect, const std::wstring&
if (high > 1)
for (;;)
{
- const size_t middle = (low + high) / 2; //=> never 0 when "high - low > 1"
if (high - low <= 1)
{
if (low == 0)
@@ -181,6 +180,7 @@ wxSize GridData::drawCellText(wxDC& dc, const wxRect& rect, const std::wstring&
}
break;
}
+ const size_t middle = (low + high) / 2; //=> never 0 when "high - low > 1"
const std::wstring& candidate = getUnicodeSubstring(text, 0, middle) + ELLIPSIS;
const wxSize extentCand = dc.GetTextExtent(candidate); //perf: most expensive call of this routine!
@@ -1193,7 +1193,7 @@ private:
//select current row *after* scrolling
wxPoint clientPosTrimmed = clientPos;
- numeric::clamp(clientPosTrimmed.y, 0, clientSize.GetHeight() - 1); //do not select row outside client window!
+ clientPosTrimmed.y = std::clamp(clientPosTrimmed.y, 0, clientSize.GetHeight() - 1); //do not select row outside client window!
const wxPoint absPos = wnd_.refParent().CalcUnscrolledPosition(clientPosTrimmed);
const ptrdiff_t newRow = wnd_.rowLabelWin_.getRowAtPos(absPos.y); //return -1 for invalid position; >= rowCount if out of range
@@ -1357,8 +1357,8 @@ void Grid::updateWindowSizes(bool updateScrollbar)
{
ptrdiff_t yFrom = CalcUnscrolledPosition(wxPoint(0, 0)).y;
ptrdiff_t yTo = CalcUnscrolledPosition(wxPoint(0, mainWinHeightGross - 1)).y ;
- numeric::clamp<ptrdiff_t>(yFrom, 0, logicalHeight - 1);
- numeric::clamp<ptrdiff_t>(yTo, 0, logicalHeight - 1);
+ yFrom = std::clamp<ptrdiff_t>(yFrom, 0, logicalHeight - 1);
+ yTo = std::clamp<ptrdiff_t>(yTo, 0, logicalHeight - 1);
const ptrdiff_t rowFrom = rowLabelWin_->getRowAtPos(yFrom);
const ptrdiff_t rowTo = rowLabelWin_->getRowAtPos(yTo);
@@ -1465,8 +1465,8 @@ wxSize Grid::GetSizeAvailableForScrollTarget(const wxSize& size)
{
ptrdiff_t yFrom = CalcUnscrolledPosition(wxPoint(0, 0)).y;
ptrdiff_t yTo = CalcUnscrolledPosition(wxPoint(0, mainWinHeightGross - 1)).y ;
- numeric::clamp<ptrdiff_t>(yFrom, 0, logicalHeight - 1);
- numeric::clamp<ptrdiff_t>(yTo, 0, logicalHeight - 1);
+ yFrom = std::clamp<ptrdiff_t>(yFrom, 0, logicalHeight - 1);
+ yTo = std::clamp<ptrdiff_t>(yTo, 0, logicalHeight - 1);
const ptrdiff_t rowFrom = rowLabelWin_->getRowAtPos(yFrom);
const ptrdiff_t rowTo = rowLabelWin_->getRowAtPos(yTo);
@@ -1499,7 +1499,7 @@ void Grid::onKeyDown(wxKeyEvent& event)
{
if (rowCount > 0)
{
- numeric::clamp<ptrdiff_t>(row, 0, rowCount - 1);
+ row = std::clamp<ptrdiff_t>(row, 0, rowCount - 1);
setGridCursor(row, GridEventPolicy::ALLOW);
}
};
@@ -1508,7 +1508,7 @@ void Grid::onKeyDown(wxKeyEvent& event)
{
if (rowCount > 0)
{
- numeric::clamp<ptrdiff_t>(row, 0, rowCount - 1);
+ row = std::clamp<ptrdiff_t>(row, 0, rowCount - 1);
selectWithCursor(row); //emits GridSelectEvent
}
};
@@ -2018,8 +2018,8 @@ void Grid::selectRange(ptrdiff_t rowFrom, ptrdiff_t rowTo, bool positive, const
auto rowLast = std::max(rowFrom, rowTo) + 1;
const size_t rowCount = getRowCount();
- numeric::clamp<ptrdiff_t>(rowFirst, 0, rowCount);
- numeric::clamp<ptrdiff_t>(rowLast, 0, rowCount);
+ rowFirst = std::clamp<ptrdiff_t>(rowFirst, 0, rowCount);
+ rowLast = std::clamp<ptrdiff_t>(rowLast, 0, rowCount);
selection_.selectRange(rowFirst, rowLast, positive);
mainWin_->Refresh();
bgstack15