diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:19:49 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:19:49 +0200 |
commit | c8e0e909b4a8d18319fc65434a10dc446434817c (patch) | |
tree | eee91e7d2ce229dd043811eae8f1e2bd78061916 /wx+/grid.cpp | |
parent | 5.2 (diff) | |
download | FreeFileSync-c8e0e909b4a8d18319fc65434a10dc446434817c.tar.gz FreeFileSync-c8e0e909b4a8d18319fc65434a10dc446434817c.tar.bz2 FreeFileSync-c8e0e909b4a8d18319fc65434a10dc446434817c.zip |
5.3
Diffstat (limited to 'wx+/grid.cpp')
-rw-r--r-- | wx+/grid.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/wx+/grid.cpp b/wx+/grid.cpp index 10e427ef..89891879 100644 --- a/wx+/grid.cpp +++ b/wx+/grid.cpp @@ -6,7 +6,6 @@ #include "grid.h" #include <cassert> -#include <ctime> #include <set> #include <wx/dcbuffer.h> //for macro: wxALWAYS_NATIVE_DOUBLE_BUFFER #include <wx/settings.h> @@ -14,6 +13,7 @@ #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 "format_unit.h" @@ -1257,7 +1257,9 @@ private: { public: MouseSelection(MainWin& wnd, ptrdiff_t rowStart, size_t compPos, bool positiveSelect) : - wnd_(wnd), rowStart_(rowStart), compPos_(compPos), rowCurrent_(rowStart), positiveSelect_(positiveSelect), toScrollX(0), toScrollY(0), tickCountLast(clock()) + wnd_(wnd), rowStart_(rowStart), compPos_(compPos), rowCurrent_(rowStart), positiveSelect_(positiveSelect), toScrollX(0), toScrollY(0), + tickCountLast(getTicks()), + ticksPerSec_(ticksPerSec()) { wnd_.CaptureMouse(); timer.Connect(wxEVT_TIMER, wxEventHandler(MouseSelection::onTimer), nullptr, this); @@ -1273,9 +1275,13 @@ private: void evalMousePos() { - const clock_t now = std::clock(); - const double deltaTime = static_cast<double>(now - tickCountLast) / CLOCKS_PER_SEC; //unit: [sec] - tickCountLast = now; + double deltaTime = 0; + if (ticksPerSec_ > 0) + { + const TickVal now = getTicks(); //0 on error + deltaTime = static_cast<double>(now - tickCountLast) / ticksPerSec_; //unit: [sec] + tickCountLast = now; + } wxMouseState mouseState = wxGetMouseState(); const wxPoint clientPos = wnd_.ScreenToClient(wxPoint(mouseState.GetX(), mouseState.GetY())); @@ -1345,7 +1351,8 @@ private: wxTimer timer; double toScrollX; //count outstanding scroll units to scroll while dragging mouse double toScrollY; // - clock_t tickCountLast; + TickVal tickCountLast; + const std::int64_t ticksPerSec_; }; virtual void ScrollWindow(int dx, int dy, const wxRect* rect) @@ -1853,6 +1860,8 @@ void Grid::selectRange(ptrdiff_t rowFrom, ptrdiff_t rowTo, size_t compPos, bool GridRangeSelectEvent selectionEvent(rowFrom, rowTo, compPos, positive); if (wxEvtHandler* evtHandler = GetEventHandler()) evtHandler->ProcessEvent(selectionEvent); + + mainWin_->Refresh(); } } |