mirror of https://github.com/stella-emu/stella.git
Fixed some crashes when scrolling in the PromptDialog.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@474 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
35f9b5b0e4
commit
f277b89710
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: DebuggerDialog.cxx,v 1.3 2005-06-07 01:27:06 stephena Exp $
|
// $Id: DebuggerDialog.cxx,v 1.4 2005-06-08 21:16:06 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -66,7 +66,7 @@ DebuggerDialog::DebuggerDialog(OSystem* osystem, DialogContainer* parent,
|
||||||
const int yoff = border + 16 + 2;
|
const int yoff = border + 16 + 2;
|
||||||
// And create the debugger dialog boxes
|
// And create the debugger dialog boxes
|
||||||
myPromptDialog = new PromptDialog(osystem, parent, x + xoff, y + yoff,
|
myPromptDialog = new PromptDialog(osystem, parent, x + xoff, y + yoff,
|
||||||
w - xoff, h - yoff);
|
w - xoff - 2, h - yoff - 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// See the file "license" for information on usage and redistribution of
|
// See the file "license" for information on usage and redistribution of
|
||||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
//
|
//
|
||||||
// $Id: PromptDialog.cxx,v 1.4 2005-06-08 18:45:09 stephena Exp $
|
// $Id: PromptDialog.cxx,v 1.5 2005-06-08 21:16:06 stephena Exp $
|
||||||
//
|
//
|
||||||
// Based on code from ScummVM - Scumm Interpreter
|
// Based on code from ScummVM - Scumm Interpreter
|
||||||
// Copyright (C) 2002-2004 The ScummVM project
|
// Copyright (C) 2002-2004 The ScummVM project
|
||||||
|
@ -98,11 +98,8 @@ void PromptDialog::drawDialog()
|
||||||
{
|
{
|
||||||
FrameBuffer& fb = instance()->frameBuffer();
|
FrameBuffer& fb = instance()->frameBuffer();
|
||||||
|
|
||||||
// Blend over the background
|
// Fill the background
|
||||||
fb.blendRect(_x, _y, _w, _h, kBGColor, 2);
|
fb.fillRect(_x, _y, _w, _h, kBGColor);
|
||||||
|
|
||||||
// Draw a border
|
|
||||||
fb.hLine(_x, _y + _h - 1, _x + _w - 1, kColor);
|
|
||||||
|
|
||||||
// Draw text
|
// Draw text
|
||||||
int start = _scrollLine - _linesPerPage + 1;
|
int start = _scrollLine - _linesPerPage + 1;
|
||||||
|
@ -230,6 +227,10 @@ cerr << "Command entered: \'" << str << "\'\n"; // FIXME - tie this into Debugge
|
||||||
case 256 + 24: // pageup
|
case 256 + 24: // pageup
|
||||||
if (instance()->eventHandler().kbdShift(modifiers))
|
if (instance()->eventHandler().kbdShift(modifiers))
|
||||||
{
|
{
|
||||||
|
// Don't scroll up when at top of buffer
|
||||||
|
if(_scrollLine < _linesPerPage)
|
||||||
|
break;
|
||||||
|
|
||||||
_scrollLine -= _linesPerPage - 1;
|
_scrollLine -= _linesPerPage - 1;
|
||||||
if (_scrollLine < _firstLineInBuffer + _linesPerPage - 1)
|
if (_scrollLine < _firstLineInBuffer + _linesPerPage - 1)
|
||||||
_scrollLine = _firstLineInBuffer + _linesPerPage - 1;
|
_scrollLine = _firstLineInBuffer + _linesPerPage - 1;
|
||||||
|
@ -242,6 +243,10 @@ cerr << "Command entered: \'" << str << "\'\n"; // FIXME - tie this into Debugge
|
||||||
case 256 + 25: // pagedown
|
case 256 + 25: // pagedown
|
||||||
if (instance()->eventHandler().kbdShift(modifiers))
|
if (instance()->eventHandler().kbdShift(modifiers))
|
||||||
{
|
{
|
||||||
|
// Don't scroll down when at bottom of buffer
|
||||||
|
if(_scrollLine >= _promptEndPos / _lineWidth)
|
||||||
|
break;
|
||||||
|
|
||||||
_scrollLine += _linesPerPage - 1;
|
_scrollLine += _linesPerPage - 1;
|
||||||
if (_scrollLine > _promptEndPos / _lineWidth)
|
if (_scrollLine > _promptEndPos / _lineWidth)
|
||||||
_scrollLine = _promptEndPos / _lineWidth;
|
_scrollLine = _promptEndPos / _lineWidth;
|
||||||
|
@ -637,8 +642,12 @@ void PromptDialog::drawCaret()
|
||||||
FrameBuffer& fb = instance()->frameBuffer();
|
FrameBuffer& fb = instance()->frameBuffer();
|
||||||
|
|
||||||
int line = _currentPos / _lineWidth;
|
int line = _currentPos / _lineWidth;
|
||||||
int displayLine = line - _scrollLine + _linesPerPage - 1;
|
|
||||||
|
|
||||||
|
// Don't draw the cursor if it's not in the current view
|
||||||
|
if(_scrollLine < line)
|
||||||
|
return;
|
||||||
|
|
||||||
|
int displayLine = line - _scrollLine + _linesPerPage - 1;
|
||||||
int x = _x + 1 + (_currentPos % _lineWidth) * _kConsoleCharWidth;
|
int x = _x + 1 + (_currentPos % _lineWidth) * _kConsoleCharWidth;
|
||||||
int y = _y + displayLine * _kConsoleLineHeight;
|
int y = _y + displayLine * _kConsoleLineHeight;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue