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

dreammaster dreammaster at scummvm.org
Thu Jul 16 03:44:13 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:
f4bd1b5948 SHERLOCK: RT: Fix display of scrollbar in the talk window


Commit: f4bd1b594851fe5ffd0bc74b593c5295c017e2bf
    https://github.com/scummvm/scummvm/commit/f4bd1b594851fe5ffd0bc74b593c5295c017e2bf
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2015-07-15T21:43:09-04:00

Commit Message:
SHERLOCK: RT: Fix display of scrollbar in the talk window

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



diff --git a/engines/sherlock/tattoo/widget_base.cpp b/engines/sherlock/tattoo/widget_base.cpp
index 9b8569c..5d81c40 100644
--- a/engines/sherlock/tattoo/widget_base.cpp
+++ b/engines/sherlock/tattoo/widget_base.cpp
@@ -218,7 +218,7 @@ void WidgetBase::drawScrollBar(int index, int pageSize, int count) {
 	_surface.fillRect(Common::Rect(r.right / 2 - 3, r.top + 1 + BUTTON_SIZE / 2,
 		r.right / 2 + 3, r.top + 1 + BUTTON_SIZE / 2), color);
 
-	color = (index + NUM_INVENTORY_SHOWN) < count ? INFO_BOTTOM + 2 : INFO_BOTTOM;
+	color = (index + pageSize) < count ? INFO_BOTTOM + 2 : INFO_BOTTOM;
 	_surface.fillRect(Common::Rect(r.right / 2 - 3, r.bottom - 1 - BUTTON_SIZE + BUTTON_SIZE / 2,
 		r.right / 2 + 3, r.bottom - 1 - BUTTON_SIZE + BUTTON_SIZE / 2), color);
 	_surface.fillRect(Common::Rect(r.right / 2 - 2, r.bottom - 1 - BUTTON_SIZE + 1 + BUTTON_SIZE / 2,
@@ -229,15 +229,10 @@ void WidgetBase::drawScrollBar(int index, int pageSize, int count) {
 		r.right / 2, r.bottom - 1 - BUTTON_SIZE + 3 + BUTTON_SIZE / 2), color);
 
 	// Draw the scroll position bar
-	int idx = count;
-	if (idx % (NUM_INVENTORY_SHOWN / 2))
-		idx = (idx + (NUM_INVENTORY_SHOWN / 2)) / (NUM_INVENTORY_SHOWN / 2) * (NUM_INVENTORY_SHOWN / 2);
-	int barHeight = NUM_INVENTORY_SHOWN * (_bounds.height() - BUTTON_SIZE * 2) / idx;
+	int barHeight = (_bounds.height() - BUTTON_SIZE * 2) * pageSize / count;
 	barHeight = CLIP(barHeight, BUTTON_SIZE, _bounds.height() - BUTTON_SIZE * 2);
+	int barY = (r.height() - BUTTON_SIZE * 2 - barHeight) * index / pageSize + r.top + BUTTON_SIZE;
 
-	int barY = (idx<= NUM_INVENTORY_SHOWN) ? r.top + BUTTON_SIZE :
-		(r.height() - BUTTON_SIZE * 2 - barHeight) * FIXED_INT_MULTIPLIER / (idx- NUM_INVENTORY_SHOWN)
-			* index / FIXED_INT_MULTIPLIER + r.top + BUTTON_SIZE;
 	_surface.fillRect(Common::Rect(r.left + 2, barY + 2, r.right - 2, barY + barHeight - 3), INFO_MIDDLE);
 	ui.drawDialogRect(_surface, Common::Rect(r.left, barY, r.right, barY + barHeight), true);
 }
diff --git a/engines/sherlock/tattoo/widget_talk.cpp b/engines/sherlock/tattoo/widget_talk.cpp
index 8db44aa..6e4ef19 100644
--- a/engines/sherlock/tattoo/widget_talk.cpp
+++ b/engines/sherlock/tattoo/widget_talk.cpp
@@ -78,18 +78,10 @@ void WidgetTalk::getTalkWindowSize() {
 		// Set up the height to a constrained amount, and add extra width for the scrollbar
 		width += BUTTON_SIZE + 3;
 		height = (_surface.fontHeight() + 1) * 6 + 9;
-		_scroll = false;
+		_scroll = true;
 	}
 
 	_bounds = Common::Rect(width, height);
-
-	// Allocate a surface for the window
-	_surface.create(_bounds.width(), _bounds.height());
-	_surface.fill(TRANSPARENCY);
-
-	// Form the background for the new window
-	makeInfoArea();
-	render(HL_CHANGED_HIGHLIGHTS);
 }
 
 void WidgetTalk::load() {
@@ -124,16 +116,6 @@ void WidgetTalk::load() {
 
 	// Form the background for the new window
 	makeInfoArea();
-
-	// If a scrollbar is needed, draw it in
-	if (_scroll) {
-		int xp = _surface.w() - BUTTON_SIZE - 6;
-		_surface.vLine(xp, 3, _surface.h() - 4, INFO_TOP);
-		_surface.vLine(xp + 1, 3, _surface.h() - 4, INFO_MIDDLE);
-		_surface.vLine(xp + 2, 3, _surface.h() - 4, INFO_BOTTOM);
-		_surface.transBlitFrom(images[6], Common::Point(xp - 1, 1));
-		_surface.transBlitFrom(images[7], Common::Point(xp - 1, _surface.h() - 4));
-	}
 }
 
 void WidgetTalk::handleEvents() {






More information about the Scummvm-git-logs mailing list