From f48374a94974f8aeb65acde6c5bc74af49e84688 Mon Sep 17 00:00:00 2001 From: JulianSmart Date: Sat, 14 Nov 2015 18:31:39 +0000 Subject: [PATCH] Added line height to wxRTC to allow faster scrolling if needed --- include/wx/richtext/richtextctrl.h | 7 +++++++ src/richtext/richtextctrl.cpp | 5 ++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/wx/richtext/richtextctrl.h b/include/wx/richtext/richtextctrl.h index a6d248faa4..a15fe4e681 100644 --- a/include/wx/richtext/richtextctrl.h +++ b/include/wx/richtext/richtextctrl.h @@ -2218,6 +2218,10 @@ public: #endif + /// Set the line increment height in pixels + void SetLineHeight(int height) { m_lineHeight = height; } + int GetLineHeight() const { return m_lineHeight; } + // Implementation /** @@ -2408,6 +2412,9 @@ protected: /// Whether images are enabled for this control bool m_enableImages; + /// Line height in pixels + int m_lineHeight; + /// Whether delayed image loading is enabled for this control bool m_enableDelayedImageLoading; bool m_delayedImageProcessingRequired; diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index d30de9725d..ddb19402a9 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -389,6 +389,9 @@ void wxRichTextCtrl::Init() m_enableDelayedImageLoading = false; m_delayedImageProcessingRequired = false; m_delayedImageProcessingTime = 0; + + // Line height in pixels + m_lineHeight = 5; } void wxRichTextCtrl::DoThaw() @@ -2923,7 +2926,7 @@ void wxRichTextCtrl::SetupScrollbars(bool atTop, bool fromOnPaint) // TODO: reimplement scrolling so we scroll by line, not by fixed number // of pixels. See e.g. wxVScrolledWindow for ideas. - int pixelsPerUnit = 5; + int pixelsPerUnit = GetLineHeight(); wxSize clientSize = GetClientSize(); int maxHeight = (int) (0.5 + GetScale() * (GetBuffer().GetCachedSize().y + GetBuffer().GetTopMargin()));