[Scummvm-cvs-logs] CVS: scummvm/gui console.cpp,1.59,1.60 console.h,1.30,1.31

Max Horn fingolfin at users.sourceforge.net
Sun Apr 17 05:04:01 CEST 2005


Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10022

Modified Files:
	console.cpp console.h 
Log Message:
Use variable width scrollbar in the console dialog

Index: console.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- console.cpp	17 Apr 2005 11:47:44 -0000	1.59
+++ console.cpp	17 Apr 2005 12:03:02 -0000	1.60
@@ -57,9 +57,21 @@
 	: Dialog(0, 0, 1, 1),
 	_widthPercent(widthPercent), _heightPercent(heightPercent) {
 
-	// Setup basic layout/dialog size
-	reflowLayout();
+	// Calculate the real width/height (rounded to char/line multiples)
+	_w = (uint16)(_widthPercent * g_system->getOverlayWidth());
+	_h = (uint16)((_heightPercent * g_system->getOverlayHeight() - 2) / kConsoleLineHeight);
+	_h = _h * kConsoleLineHeight + 2;
+
+	// Add scrollbar
+	int scrollBarWidth = kDefaultScrollBarWidth;
+	if (g_system->getOverlayWidth() >= 640)
+		scrollBarWidth = 14;
+	_scrollBar = new ScrollBarWidget(this, _w - scrollBarWidth - 1, 0, scrollBarWidth, _h);
+	_scrollBar->setTarget(this);
 
+	// Reset the line buffer
+	_lineWidth = (_w - scrollBarWidth - 2) / kConsoleCharWidth;
+	_linesPerPage = (_h - 2) / kConsoleLineHeight;
 	memset(_buffer, ' ', kBufferSize);
 	_linesInBuffer = kBufferSize / _lineWidth;
 
@@ -73,9 +85,6 @@
 	_slideMode = kNoSlideMode;
 	_slideTime = 0;
 
-	// Add scrollbar
-	_scrollBar = new ScrollBarWidget(this, _w - kDefaultScrollBarWidth - 1, 0, kDefaultScrollBarWidth, _h);
-	_scrollBar->setTarget(this);
 
 	// Init callback
 	_callbackProc = 0;
@@ -95,19 +104,6 @@
 	print("\nConsole is ready\n");
 }
 
-void ConsoleDialog::reflowLayout() {
-	// Calculate the real width/height (rounded to char/line multiples)
-	_w = (uint16)(_widthPercent * g_system->getOverlayWidth());
-//	_w = (_widthPercent * g_system->getOverlayWidth() - kDefaultScrollBarWidth - 2) / kConsoleCharWidth;
-//	_w = _w * kConsoleCharWidth + kDefaultScrollBarWidth + 2;
-	_h = (uint16)((_heightPercent * g_system->getOverlayHeight() - 2) / kConsoleLineHeight);
-	_h = _h * kConsoleLineHeight + 2;
-
-	// Calculate depending values
-	_lineWidth = (_w - kDefaultScrollBarWidth - 2) / kConsoleCharWidth;
-	_linesPerPage = (_h - 2) / kConsoleLineHeight;
-}
-
 void ConsoleDialog::slideUpAndClose() {
 	if (_slideMode == kNoSlideMode) {
 		_slideTime = g_system->getMillis();

Index: console.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/console.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- console.h	17 Apr 2005 11:20:58 -0000	1.30
+++ console.h	17 Apr 2005 12:03:03 -0000	1.31
@@ -86,8 +86,6 @@
 
 	float _widthPercent, _heightPercent;
 
-	void reflowLayout();
-	
 	void slideUpAndClose();
 
 public:





More information about the Scummvm-git-logs mailing list