Add a virtual function to the Console class so that it does not need to keep track of the window.

This commit is contained in:
DarwinNE 2020-01-16 00:01:26 +01:00
parent d40eacf12e
commit 9cf5c41ad7
4 changed files with 20 additions and 9 deletions

View File

@ -286,13 +286,12 @@ void Console::ProcessOSCseq(char c)
return;
}
++sequenceStep;
windowName=" ";
windowName="";
break;
default:
if(c==BEL) // The BEL character ends the sequence.
{
windowName[0]=windowName.length();
SetWTitle(win, (ConstStringPtr)windowName.c_str());
setWindowName(windowName);
OSCseq=false;
isProcessingEscSequence=false;
sequenceStep=0;

View File

@ -86,14 +86,15 @@ namespace retro
short GetRows() const { return rows; }
short GetCols() const { return cols; }
virtual void setWindowName(std::string newName) {};
void Idle();
bool IsEOF() const { return eof; }
protected:
std::string windowName;
WindowPtr win;
private:
std::string windowName;
GrafPtr consolePort = nullptr;
Rect bounds;
Attributes currentAttr;

View File

@ -36,8 +36,9 @@ ConsoleWindow::ConsoleWindow(Rect r, ConstStr255Param title)
{
GrafPtr port;
//Retro68 Improved Console
windowName="Retro68 Console";
win = NewWindow(NULL, &r, "\pRetro68 Console", true, 0, (WindowPtr)-1, true, 0);
win = NewWindow(NULL, &r, "\p", true, 0, (WindowPtr)-1, true, 0);
setWindowName("Retro68 Console");
#if !TARGET_API_MAC_CARBON
port = win;
@ -64,6 +65,14 @@ ConsoleWindow::~ConsoleWindow()
DisposeWindow(win);
}
void ConsoleWindow::setWindowName(std::string newName)
{
newName=" "+newName; // Convert into Pascal string
newName[0]=newName.length();
SetWTitle(win, (ConstStringPtr)newName.c_str());
}
char ConsoleWindow::WaitNextChar()
{
EventRecord event;

View File

@ -34,8 +34,10 @@ namespace retro
public:
ConsoleWindow(Rect r, ConstStr255Param title);
~ConsoleWindow();
void setWindowName(std::string newName);
private:
//WindowPtr win;
WindowPtr win;
virtual char WaitNextChar();
};