diff options
| -rw-r--r-- | gtk/ScintillaGTK.cxx | 18 | ||||
| -rw-r--r-- | include/Scintilla.h | 2 | ||||
| -rw-r--r-- | include/Scintilla.iface | 6 | ||||
| -rw-r--r-- | src/Editor.cxx | 12 | ||||
| -rw-r--r-- | src/Editor.h | 1 | ||||
| -rw-r--r-- | win32/ScintillaWin.cxx | 7 | 
6 files changed, 40 insertions, 6 deletions
| diff --git a/gtk/ScintillaGTK.cxx b/gtk/ScintillaGTK.cxx index 472160994..1e67e44be 100644 --- a/gtk/ScintillaGTK.cxx +++ b/gtk/ScintillaGTK.cxx @@ -639,7 +639,8 @@ void ScintillaGTK::FullPaint() {  PRectangle ScintillaGTK::GetClientRectangle() {  	PRectangle rc = wMain.GetClientPosition(); -	rc.right -= scrollBarWidth + 1; +	if (verticalScrollBarVisible) +		rc.right -= scrollBarWidth + 1;  	if (horizontalScrollBarVisible)  		rc.bottom -= scrollBarHeight + 1;  	// Move to origin @@ -1085,6 +1086,9 @@ void ScintillaGTK::Resize(int width, int height) {  	int horizontalScrollBarHeight = scrollBarWidth;  	if (!horizontalScrollBarVisible)  		horizontalScrollBarHeight = 0; +	int verticalScrollBarHeight = scrollBarHeight; +	if (!verticalScrollBarVisible) +		verticalScrollBarHeight = 0;  	GtkAllocation alloc;  	alloc.x = 0; @@ -1099,10 +1103,16 @@ void ScintillaGTK::Resize(int width, int height) {  	}  	gtk_widget_size_allocate(GTK_WIDGET(PWidget(scrollbarh)), &alloc); -	alloc.x = width - scrollBarWidth;  	alloc.y = 0; -	alloc.width = scrollBarWidth; -	alloc.height = Platform::Maximum(1, height - scrollBarHeight) + 1; +	if (verticalScrollBarVisible) { +		alloc.x = width - scrollBarWidth; +		alloc.width = scrollBarWidth; +		alloc.height = Platform::Maximum(1, height - scrollBarHeight) + 1; +	} else { +		alloc.x = width; +		alloc.width = 0; +		alloc.height = 0; +	}  	gtk_widget_size_allocate(GTK_WIDGET(PWidget(scrollbarv)), &alloc);  	ChangeSize(); diff --git a/include/Scintilla.h b/include/Scintilla.h index 7fe86fff1..a44da5c13 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -377,6 +377,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,  #define SCI_SETENDATLASTLINE 2277  #define SCI_GETENDATLASTLINE 2278  #define SCI_TEXTHEIGHT 2279 +#define SCI_SETVSCROLLBAR 2280 +#define SCI_GETVSCROLLBAR 2281  #define SCI_LINEDOWN 2300  #define SCI_LINEDOWNEXTEND 2301  #define SCI_LINEUP 2302 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index bcaf00ae6..06ef8e7cd 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -988,6 +988,12 @@ get int GetEndAtLastLine=2278(,)  # Retrieve the height of a particular line of text in pixels.  fun int TextHeight=2279(int line,) +# Show or hide the vertical scroll bar. +set void SetVScrollBar=2280(bool show,) + +# Is the vertical scroll bar visible? +get bool GetVScrollBar=2281(,) +  ## Start of key messages  # Move caret down one line.  fun void LineDown=2300(,) diff --git a/src/Editor.cxx b/src/Editor.cxx index ac7e7bb76..62a035613 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -327,6 +327,7 @@ Editor::Editor() {  	xCaretMargin = 50;  	horizontalScrollBarVisible = true;  	scrollWidth = 2000; +	verticalScrollBarVisible = true;  	endAtLastLine = true;  	pixmapLine = Surface::Allocate(); @@ -5089,6 +5090,17 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {  	case SCI_GETHSCROLLBAR:  		return horizontalScrollBarVisible; +	case SCI_SETVSCROLLBAR: +		if (verticalScrollBarVisible != (wParam != 0)) { +			verticalScrollBarVisible = wParam != 0; +			SetScrollBars(); +			ReconfigureScrollBars(); +		} +		break; + +	case SCI_GETVSCROLLBAR: +		return verticalScrollBarVisible; +  	case SCI_SETINDENTATIONGUIDES:  		vs.viewIndentationGuides = wParam != 0;  		Redraw(); diff --git a/src/Editor.h b/src/Editor.h index 800630bbb..3d99676ae 100644 --- a/src/Editor.h +++ b/src/Editor.h @@ -201,6 +201,7 @@ 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 verticalScrollBarVisible;  	bool endAtLastLine;  	Surface *pixmapLine; diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 34e2f2e7a..c1930cbe8 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -902,15 +902,18 @@ bool ScintillaWin::ModifyScrollBars(int nMax, int nPage) {  	};  	sci.fMask = SIF_PAGE | SIF_RANGE;  	::GetScrollInfo(MainHWND(), SB_VERT, &sci); +	int vertEndPreferred = nMax; +	if (!verticalScrollBarVisible) +		vertEndPreferred = 0;  	if ((sci.nMin != 0) || -		(sci.nMax != nMax) || +		(sci.nMax != vertEndPreferred) ||  	        (sci.nPage != static_cast<unsigned int>(nPage)) ||  	        (sci.nPos != 0)) {  		//Platform::DebugPrintf("Scroll info changed %d %d %d %d %d\n",  		//	sci.nMin, sci.nMax, sci.nPage, sci.nPos, sci.nTrackPos);  		sci.fMask = SIF_PAGE | SIF_RANGE;  		sci.nMin = 0; -		sci.nMax = nMax; +		sci.nMax = vertEndPreferred;  		sci.nPage = nPage;  		sci.nPos = 0;  		sci.nTrackPos = 1; | 
