[QScintilla] Patch for scroll width and scroll width tracking messages
Manuel Gómez
mgrojo at gmail.com
Sun Nov 12 13:49:06 GMT 2017
Hi,
The attached patch adds methods for the following Scintilla messages:
SCI_SETSCROLLWIDTH
SCI_GETSCROLLWIDTH
SCI_SETSCROLLWIDTHTRACKING
SCI_GETSCROLLWIDTHTRACKING
The patch has been developed for the DB Browser for SQLite and works
well for avoiding the unnecessary display of the horizontal scroll bar.
See this for explanation:
https://github.com/jacobslusser/ScintillaNET/issues/216
Regards
--
Manuel
-------------- next part --------------
diff --git a/libs/qscintilla/Qt4Qt5/Qsci/qsciscintilla.h b/libs/qscintilla/Qt4Qt5/Qsci/qsciscintilla.h
index 3b5f185..49ca5cc 100644
--- a/libs/qscintilla/Qt4Qt5/Qsci/qsciscintilla.h
+++ b/libs/qscintilla/Qt4Qt5/Qsci/qsciscintilla.h
@@ -2009,6 +2009,34 @@ public slots:
//! \sa zoomIn(), zoomOut()
virtual void zoomTo(int size);
+ //! For performance, Scintilla does not measure the display width
+ //! of the document to determine the properties of the horizontal
+ //! scroll bar. Instead, an assumed width is used. This sets the
+ //! document width in pixels assumed by Scintilla to \a
+ //! pixelWidth. The default value is 2000.
+ //!
+ //! \sa getScrollWidth(), setScrollWidthTracking()
+ virtual void setScrollWidth(int pixelWidth);
+
+ //! Gets the document width in pixels assumed by Scintilla.
+ //!
+ //! \sa setScrollWidth(), setScrollWidthTracking()
+ virtual int getScrollWidth() const;
+
+ //! If scroll width tracking is enabled then the scroll width is
+ //! adjusted to ensure that all of the lines currently displayed
+ //! can be completely scrolled. This mode never adjusts the scroll
+ //! width to be narrower.
+ //! Sets the scroll width tracking to \a enabled.
+ //!
+ //! \sa setScrollWidth(), getScrollWidthTracking()
+ virtual void setScrollWidthTracking(bool enabled);
+
+ //! Gets the current scroll width tracking mode.
+ //!
+ //! \sa getScrollWidth(), setScrollWidthTracking()
+ virtual bool getScrollWidthTracking() const;
+
signals:
//! This signal is emitted whenever the cursor position changes. \a line
//! contains the line number and \a index contains the character index
diff --git a/libs/qscintilla/Qt4Qt5/qsciscintilla.cpp b/libs/qscintilla/Qt4Qt5/qsciscintilla.cpp
index 4c9fe75..31dc579 100644
--- a/libs/qscintilla/Qt4Qt5/qsciscintilla.cpp
+++ b/libs/qscintilla/Qt4Qt5/qsciscintilla.cpp
@@ -4481,3 +4481,26 @@ static QColor asQColor(long sci_colour)
((int)(sci_colour >> 8)) & 0x00ff,
((int)(sci_colour >> 16)) & 0x00ff);
}
+
+void QsciScintilla::setScrollWidth(int pixelWidth)
+{
+ SendScintilla(SCI_SETSCROLLWIDTH, pixelWidth);
+}
+
+int QsciScintilla::getScrollWidth() const
+{
+ return SendScintilla(SCI_GETSCROLLWIDTH);
+}
+
+void QsciScintilla::setScrollWidthTracking(bool enabled)
+{
+ SendScintilla(SCI_SETSCROLLWIDTHTRACKING, enabled);
+}
+
+bool QsciScintilla::getScrollWidthTracking() const
+{
+ return SendScintilla(SCI_GETSCROLLWIDTHTRACKING);
+}
+
+
+
More information about the QScintilla
mailing list