[Scummvm-cvs-logs] scummvm master -> d8cdaabadfa67526794d83e6ab7c59bb46f1b54c

dreammaster dreammaster at scummvm.org
Sun Jul 26 13:49:43 CEST 2015


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d8cdaabadf SHERLOCK: RT: Further fixes for scrolling in Files dialog


Commit: d8cdaabadfa67526794d83e6ab7c59bb46f1b54c
    https://github.com/scummvm/scummvm/commit/d8cdaabadfa67526794d83e6ab7c59bb46f1b54c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-07-26T07:49:03-04:00

Commit Message:
SHERLOCK: RT: Further fixes for scrolling in Files dialog

Changed paths:
    engines/sherlock/tattoo/widget_base.cpp
    engines/sherlock/tattoo/widget_files.cpp



diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp
index e0b9039..cc8e5c9 100644
--- a/engines/sherlock/tattoo/widget_base.cpp
+++ b/engines/sherlock/tattoo/widget_base.cpp
@@ -330,21 +330,8 @@ void WidgetBase::handleScrolling(int &scrollIndex, int pageSize, int max) {
 			yp = CLIP(yp, r.top + BUTTON_SIZE + 3, r.bottom - BUTTON_SIZE - 3);
 
 			// Calculate the line number that corresponds to the position that the mouse is on the scrollbar
-			int lineNum = (yp - _bounds.top - BUTTON_SIZE - 3) * 100 / (_bounds.height() - BUTTON_SIZE * 2 - 6)
-				* max / 100 - 3;
-
-			// If the new position would place part of the text outsidethe text window, adjust it so it doesn't
-			if (lineNum < 0)
-				lineNum = 0;
-			else if (lineNum + pageSize > max) {
-				lineNum = max - pageSize;
-
-				// Make sure it's not below zero now
-				if (lineNum < 0)
-					lineNum = 0;
-			}
-
-			scrollIndex = lineNum;
+			int lineNum = (yp - r.top - BUTTON_SIZE - 3) * (max - pageSize) / (r.height() - BUTTON_SIZE * 2 - 6);
+			scrollIndex = CLIP(lineNum, 0, max - pageSize);
 		}
 
 		// Get the current frame so we can check the scroll timer against it
diff --git a/engines/sherlock/tattoo/widget_files.cpp b/engines/sherlock/tattoo/widget_files.cpp
index 4a0c049..29ca0c5 100644
--- a/engines/sherlock/tattoo/widget_files.cpp
+++ b/engines/sherlock/tattoo/widget_files.cpp
@@ -150,7 +150,7 @@ void WidgetFiles::render(FilesRenderMode mode) {
 				color = INFO_TOP;
 
 			if (mode == RENDER_NAMES_AND_SCROLLBAR)
-				_surface.fillRect(Common::Rect(4, yp, _surface.w() - BUTTON_SIZE - 9, yp + _surface.fontHeight() - 1), TRANSPARENCY);
+				_surface.fillRect(Common::Rect(4, yp, _surface.w() - BUTTON_SIZE - 9, yp + _surface.fontHeight()), TRANSPARENCY);
 			
 			Common::String numStr = Common::String::format("%d.", idx + 1);
 			_surface.writeString(numStr, Common::Point(_surface.widestChar(), yp), color);






More information about the Scummvm-git-logs mailing list