GUI: Add possibility to specify Debugger prompt

This commit is contained in:
Eugene Sandulenko 2023-02-04 14:58:54 +01:00
parent 007d94963b
commit b97b2b0fe3
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
4 changed files with 32 additions and 2 deletions

View File

@ -121,6 +121,16 @@ void ConsoleDialog::init() {
_pageWidth = (_w - scrollBarWidth - 2 - _leftPadding - _topPadding - scrollBarWidth) / kConsoleCharWidth;
_linesPerPage = (_h - 2 - _topPadding - _bottomPadding) / kConsoleLineHeight;
_linesInBuffer = kBufferSize / kCharsPerLine;
resetPrompt();
}
void ConsoleDialog::setPrompt(Common::String prompt) {
_prompt = prompt;
}
void ConsoleDialog::resetPrompt() {
_prompt = PROMPT;
}
void ConsoleDialog::slideUpAndClose() {
@ -159,7 +169,7 @@ void ConsoleDialog::open() {
if ((_promptStartPos == -1) || (_currentPos > _promptEndPos)) {
// we print a prompt, if this is the first time we are called or if the
// engine wrote onto us since the last call
print(PROMPT);
print(_prompt.c_str());
_promptStartPos = _promptEndPos = _currentPos;
}
@ -283,7 +293,7 @@ void ConsoleDialog::handleKeyDown(Common::KeyState state) {
keepRunning = (*_callbackProc)(this, userInput.c_str(), _callbackRefCon);
}
print(PROMPT);
print(_prompt.c_str());
_promptStartPos = _promptEndPos = _currentPos;
g_gui.scheduleTopDialogRedraw();

View File

@ -129,6 +129,8 @@ protected:
void slideUpAndClose();
Common::String _prompt;
public:
ConsoleDialog(float widthPercent, float heightPercent);
virtual ~ConsoleDialog();
@ -161,6 +163,9 @@ public:
return _pageWidth;
}
void setPrompt(Common::String prompt);
void resetPrompt();
protected:
inline char &buffer(int idx) {
return _buffer[idx % kBufferSize];

View File

@ -92,6 +92,18 @@ void Debugger::clearVars() {
}
void Debugger::setPrompt(Common::String prompt) {
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
_debuggerDialog->setPrompt(prompt);
#endif
}
void Debugger::resetPrompt() {
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER
_debuggerDialog->resetPrompt();
#endif
}
// Initialisation Functions
int Debugger::getCharsPerLine() {
#ifndef USE_TEXT_CONSOLE_FOR_DEBUGGER

View File

@ -168,6 +168,9 @@ protected:
*/
void clearVars();
void setPrompt(Common::String prompt);
void resetPrompt();
private:
/**
* The frame countdown specifies a number of frames that must pass