diff options
author | nyamatongwe <unknown> | 2007-07-02 00:47:30 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2007-07-02 00:47:30 +0000 |
commit | 4ab7b0b4e4ef21b23f4896ed56031405d89a1e9a (patch) | |
tree | 058fbd4ee99353e156a4ce1c739c1155d7019a76 /src | |
parent | a016d13fff6df381d02279b130397852a1d47477 (diff) | |
download | scintilla-mirror-4ab7b0b4e4ef21b23f4896ed56031405d89a1e9a.tar.gz |
Scroll width tracking feature.
Diffstat (limited to 'src')
-rw-r--r-- | src/Editor.cxx | 19 | ||||
-rw-r--r-- | src/Editor.h | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx index b7fa63e22..5d79d550a 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -138,6 +138,8 @@ Editor::Editor() { xCaretMargin = 50; horizontalScrollBarVisible = true; scrollWidth = 2000; + trackLineWidth = false; + lineWidthMaxSeen = 0; verticalScrollBarVisible = true; endAtLastLine = true; caretSticky = false; @@ -1205,7 +1207,7 @@ void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { xOffset = xOffsetNew; if (xOffsetNew > 0) { PRectangle rcText = GetTextRectangle(); - if (horizontalScrollBarVisible == true && + if (horizontalScrollBarVisible && rcText.Width() + xOffset > scrollWidth) { scrollWidth = xOffset + rcText.Width(); SetScrollBars(); @@ -2948,6 +2950,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { yposScreen += vs.lineHeight; visibleLine++; + + lineWidthMaxSeen = Platform::Maximum( + lineWidthMaxSeen, ll->positions[ll->numCharsInLine]); //gdk_flush(); } ll.Set(0); @@ -5353,6 +5358,10 @@ void Editor::Tick() { } } } + if (horizontalScrollBarVisible && trackLineWidth && (lineWidthMaxSeen > scrollWidth)) { + scrollWidth = lineWidthMaxSeen; + SetScrollBars(); + } if ((dwellDelay < SC_TIME_FOREVER) && (ticksToDwell > 0) && (!HaveMouseCapture())) { @@ -6464,6 +6473,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_SETSCROLLWIDTH: PLATFORM_ASSERT(wParam > 0); if ((wParam > 0) && (wParam != static_cast<unsigned int >(scrollWidth))) { + lineWidthMaxSeen = 0; scrollWidth = wParam; SetScrollBars(); } @@ -6472,6 +6482,13 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { case SCI_GETSCROLLWIDTH: return scrollWidth; + case SCI_SETSCROLLWIDTHTRACKING: + trackLineWidth = wParam != 0; + break; + + case SCI_GETSCROLLWIDTHTRACKING: + return trackLineWidth; + case SCI_LINESJOIN: LinesJoin(); break; diff --git a/src/Editor.h b/src/Editor.h index 501abb632..2115af7d9 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -136,6 +136,8 @@ protected: // ScintillaBase subclass needs access to much of Editor int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret bool horizontalScrollBarVisible; int scrollWidth; + bool trackLineWidth; + int lineWidthMaxSeen; bool verticalScrollBarVisible; bool endAtLastLine; bool caretSticky; |