From 155e2beafde9adf705643d86250085554ac00a47 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 3 May 2020 20:56:59 +0200 Subject: [PATCH] Use symbolic constant instead of hardcoded 15/85% It's still hardcoded, but now it has a name, which explains what it is and can be searched for. No real changes. --- src/generic/datavgen.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 62470e0a10..1518e6e4b4 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -2165,7 +2165,11 @@ wxDataViewMainWindow::DropItemInfo wxDataViewMainWindow::GetDropItemInfo(const w const int itemStart = GetLineStart(row); const int itemHeight = GetLineHeight(row); - bool insertAbove = yy - itemStart < itemHeight*0.15; // 15%, TODO: configurable + // 15% is an arbitrarily chosen threshold here, which could be changed + // or made configurable if really needed. + static const double UPPER_ITEM_PART = 0.15; + + bool insertAbove = yy - itemStart < itemHeight*UPPER_ITEM_PART; if (insertAbove) { // Can be treated as 'insertBelow" with the small difference: @@ -2186,7 +2190,7 @@ wxDataViewMainWindow::DropItemInfo wxDataViewMainWindow::GetDropItemInfo(const w } - bool insertBelow = yy - itemStart > itemHeight*0.85; // 15%, TODO: configurable + bool insertBelow = yy - itemStart > itemHeight*(1.0 - UPPER_ITEM_PART); if (insertBelow) dropItemInfo.m_hint = DropHint_Below;